diff options
author | Martin Green <martin.speleo@gmail.com> | 2011-06-02 19:16:16 +0100 |
---|---|---|
committer | Martin Green <martin.speleo@gmail.com> | 2011-06-02 19:16:16 +0100 |
commit | 50545af223eaee708cc465363247201123707bd3 (patch) | |
tree | 31dc3fd8ab20dba26e0276e7663c9597f1e50c4a /parsers/cavetab.py | |
parent | ede9e4a9bdfe3cfc49f53afa7347850d31f0014d (diff) | |
download | troggle-50545af223eaee708cc465363247201123707bd3.tar.gz troggle-50545af223eaee708cc465363247201123707bd3.tar.bz2 troggle-50545af223eaee708cc465363247201123707bd3.zip |
Added editing of flat pages. Added slugfields to models to refer to them.
Diffstat (limited to 'parsers/cavetab.py')
-rw-r--r-- | parsers/cavetab.py | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/parsers/cavetab.py b/parsers/cavetab.py index 0fbde43..bf61d7f 100644 --- a/parsers/cavetab.py +++ b/parsers/cavetab.py @@ -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()
|