fix minor bug in setting dummy entrance

This commit is contained in:
Philip Sargent 2022-07-25 11:31:43 +03:00
parent f9a7ba7927
commit cddcb0e321
2 changed files with 7 additions and 6 deletions

View File

@ -49,10 +49,10 @@ def dummy_entrance(k, slug, msg="DUMMY"):
if ent: if ent:
ent.save() # must save to have id before foreign keys work. ent.save() # must save to have id before foreign keys work.
try: # Now create a entrance slug ID try: # Now create a entrance slug ID
es = EntranceSlug.objects.update_or_create(entrance = ent, es = EntranceSlug(entrance = ent,
slug = slug, primary = False) slug = slug, primary = False)
except: except:
message = f" ! {k:11s} {msg} entrance create failure" message = f" ! {k:11s} {msg}-{slug} entrance create failure"
DataIssue.objects.create(parser='caves', message=message, url=f'{slug}') DataIssue.objects.create(parser='caves', message=message, url=f'{slug}')
print(message) print(message)
@ -75,11 +75,12 @@ def set_dummy_entrance(id, slug, cave, msg="DUMMY"):
letter = "" letter = ""
entrances_xslug[slug] = entrance entrances_xslug[slug] = entrance
ce = CaveAndEntrance.objects.update_or_create(cave = cave, entrance_letter = "", entrance = entrance) ce = CaveAndEntrance.objects.update_or_create(cave = cave, entrance_letter = "", entrance = entrance)
message = f' ! Warning: Dummy Entrance created for {id}' message = f' ! Warning: Dummy Entrance successfully set for entrance {id} on cave {cave}'
DataIssue.objects.create(parser='caves', message=message, url=f'{cave.url}') DataIssue.objects.create(parser='caves', message=message, url=f'{cave.url}')
print(message) print(message)
except: except:
#raise
message = f' ! Entrance Dummy setting failure, slug:"{slug}" cave id :"{id}" ' message = f' ! Entrance Dummy setting failure, slug:"{slug}" cave id :"{id}" '
DataIssue.objects.create(parser='caves', message=message, url=f'{cave.url}') DataIssue.objects.create(parser='caves', message=message, url=f'{cave.url}')
print(message) print(message)

View File

@ -11,8 +11,8 @@
<cave> <cave>
<non_public>{{ cave.non_public }}</non_public>{% for slug in cave.caveslug_set.all %}<!-- 'False' or 'True'. True if the cave should only be visible to logged-in users. Caves are normally public, so enter 'False' unless you know otherwise. --> <non_public>{{ cave.non_public }}</non_public>{% for slug in cave.caveslug_set.all %}<!-- 'False' or 'True'. True if the cave should only be visible to logged-in users. Caves are normally public, so enter 'False' unless you know otherwise. -->
<caveslug>{{ slug.slug|default_if_none:"1623-000"|safe }}</caveslug>{% endfor %}<!--(Required). Internal I.D. used to refer to this cave in entrance data files. Typically the same as the filebase, e.g. '1623-195' --> <caveslug>{{ slug.slug|default_if_none:"1623-000"|safe }}</caveslug>{% endfor %}<!--(Required). Internal I.D. used to refer to this cave in entrance data files. Typically the same as the filebase, e.g. '1623-195' -->
<official_name>{{ cave.official_name|default_if_none:""|safe }}</official_name><!-- Use &uuml; for u+Umlaut and &ouml; for o+umlaut eg H&ouml;hle for Hohle and Gl&uuml;ck for Gluck-->{% for area in cave.area.all %}<!-- Name of the cave (normally in German) --> <official_name>{{ cave.official_name|default_if_none:""|safe }}</official_name><!-- Name of the cave (normally in German) Use &uuml; for u+Umlaut and &ouml; for o+umlaut eg H&ouml;hle for Hohle and Gl&uuml;ck for Gluck-->
<area>{{ area.short_name|default_if_none:""|safe }}</area>{% endfor %}<!-- the CUCC-defined areas shown in http://expo.survex.com/areas.htm --> {% for area in cave.area.all %}<area>{{ area.short_name|default_if_none:""|safe }}</area>{% endfor %}<!-- the CUCC-defined areas shown in http://expo.survex.com/areas.htm -->
<kataster_code>{{ cave.kataster_code|default_if_none:""|safe }}</kataster_code><!-- 'length-or-depth/type exploration' <kataster_code>{{ cave.kataster_code|default_if_none:""|safe }}</kataster_code><!-- 'length-or-depth/type exploration'
code used in the Austrian kataster e.g '1/S +' - https://expo/.survex.com/katast.htm code used in the Austrian kataster e.g '1/S +' - https://expo/.survex.com/katast.htm
@ -29,7 +29,7 @@ code used in the Austrian kataster e.g '1/S +' - https://expo/.survex.com/katast
+ erforscht (exploration considered complete) + erforscht (exploration considered complete)
--> -->
<kataster_number>{{ cave.kataster_number|default_if_none:""|safe }}</kataster_number> <!-- (Either this or unofficial_number is required). Official number in Austrian kataster if one has been allocated --> <kataster_number>{{ cave.kataster_number|default_if_none:""|safe }}</kataster_number> <!-- (Either this or unofficial_number is required). Official number in Austrian kataster if one has been allocated -->
<unofficial_number>{{ cave.unofficial_number|default_if_none:"2020-XX-01"|safe }}</unofficial_number><!-- (Either this or kataster_number is required). Initial temporary cave ID used until kataster number is allocated e.g. '2012-DD-01'--> <unofficial_number>{{ cave.unofficial_number|default_if_none:"2022-XX-nn"|safe }}</unofficial_number><!-- (Either this or kataster_number is required). Initial temporary cave ID used until kataster number is allocated e.g. '2012-DD-01'-->
{% for ce in cave.entrances.all %} {% for ce in cave.entrances.all %}
<entrance> <entrance>
<entranceslug>{{ ce.entrance.slug|default_if_none:""|safe }}</entranceslug><!-- Internal ID to refer to each entrance instance in the entrance files (typically the same as that filename (e.g. 1623-161c). Matches the 'slug' field in the entrance file --> <entranceslug>{{ ce.entrance.slug|default_if_none:""|safe }}</entranceslug><!-- Internal ID to refer to each entrance instance in the entrance files (typically the same as that filename (e.g. 1623-161c). Matches the 'slug' field in the entrance file -->