Added editing of flat pages. Added slugfields to models to refer to them.

This commit is contained in:
Martin Green
2011-06-02 19:16:16 +01:00
parent ede9e4a9bd
commit 50545af223
17 changed files with 376 additions and 20 deletions

View File

@@ -103,7 +103,16 @@ def LoadCaveTab():
addToDefaultArgs(Extent, "extent")
addToDefaultArgs(SurvexFile, "survex_file")
addToDefaultArgs(Notes, "notes")
if line[Area] == "1626":
if line[KatasterNumber] != "":
args["slug"] = line[Area] + "-" + line[KatasterNumber]
else:
args["slug"] = line[Area] + "-" + line[UnofficialNumber]
else:
if line[KatasterNumber] != "":
args["slug"] = "1623" + "-" + line[KatasterNumber]
else:
args["slug"] = "1623" + "-" + line[UnofficialNumber]
#The following adds the legacy_file_path. This is always in either Autogen file or Link file
for header in (AutogenFile,LinkFile):
if line[header]:
@@ -148,6 +157,12 @@ def LoadCaveTab():
line[MultipleEntrances] == 'entrance' or \
line[MultipleEntrances] == 'last entrance':
args = {}
if line[Entrances]:
entrance_letter = line[Entrances]
else:
entrance_letter = ''
def addToArgs(CSVname, modelName):
if line[CSVname]:
args[modelName] = html_to_wiki(line[CSVname])
@@ -201,15 +216,12 @@ def LoadCaveTab():
addToArgsSurveyStation(GPSpostSA, 'other_station')
args['other_description'] = 'post selective availability GPS'
addToArgs(Bearings, 'bearings')
args['slug'] = newCave.slug + entrance_letter
newEntrance = models.Entrance(**args)
newEntrance.save()
logging.info("Added entrance "+str(newEntrance)+"\n")
if line[Entrances]:
entrance_letter = line[Entrances]
else:
entrance_letter = ''
newCaveAndEntrance = models.CaveAndEntrance(cave = newCave, entrance = newEntrance, entrance_letter = entrance_letter)
newCaveAndEntrance.save()