mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2024-11-25 08:41:51 +00:00
ent.url removed and entrance edit path simplified
This commit is contained in:
parent
1ba37665b5
commit
1e8a5bea6e
@ -185,7 +185,7 @@ class EntranceForm(ModelForm):
|
|||||||
model = Entrance
|
model = Entrance
|
||||||
exclude = (
|
exclude = (
|
||||||
"cached_primary_slug",
|
"cached_primary_slug",
|
||||||
"filename",
|
"filename"
|
||||||
)
|
)
|
||||||
|
|
||||||
def clean(self):
|
def clean(self):
|
||||||
|
@ -251,7 +251,6 @@ class Entrance(TroggleModel):
|
|||||||
photo = models.TextField(blank=True, null=True)
|
photo = models.TextField(blank=True, null=True)
|
||||||
slug = models.SlugField(max_length=50, unique=True, default="default_slug_id")
|
slug = models.SlugField(max_length=50, unique=True, default="default_slug_id")
|
||||||
underground_description = models.TextField(blank=True, null=True)
|
underground_description = models.TextField(blank=True, null=True)
|
||||||
url = models.CharField(max_length=300, blank=True, null=True)
|
|
||||||
|
|
||||||
tag_station = models.TextField(blank=True, null=True)
|
tag_station = models.TextField(blank=True, null=True)
|
||||||
other_station = models.TextField(blank=True, null=True)
|
other_station = models.TextField(blank=True, null=True)
|
||||||
|
@ -551,10 +551,9 @@ def read_entrance(filename, ent=None):
|
|||||||
ent.other_description=other_description[0]
|
ent.other_description=other_description[0]
|
||||||
ent.other_station=other_station[0]
|
ent.other_station=other_station[0]
|
||||||
ent.photo=photo[0]
|
ent.photo=photo[0]
|
||||||
# ent.slug=slugs[0]
|
# ent.slug=slugs[0] # set algorithically
|
||||||
ent.tag_station=tag_station[0]
|
ent.tag_station=tag_station[0]
|
||||||
ent.underground_description=underground_description[0]
|
ent.underground_description=underground_description[0]
|
||||||
ent.url=url[0]
|
|
||||||
|
|
||||||
for st in [ent.other_station, ent.tag_station]:
|
for st in [ent.other_station, ent.tag_station]:
|
||||||
#validate_station(st)
|
#validate_station(st)
|
||||||
@ -604,12 +603,15 @@ def read_cave(filename, cave=None):
|
|||||||
letter = getXML(e, "letter", maxItems=1, context=context)[0]
|
letter = getXML(e, "letter", maxItems=1, context=context)[0]
|
||||||
|
|
||||||
if len(entrances) > 1 and letter =="":
|
if len(entrances) > 1 and letter =="":
|
||||||
# user error, but we can recover
|
# Usually the second entrance is 'b', but the first is still unlettered. So probably 'a'
|
||||||
letter = eslug[-1].lower()
|
letter = eslug[-1].lower()
|
||||||
if letter.lower() not in list(string.ascii_lowercase):
|
if letter.lower() not in list(string.ascii_lowercase):
|
||||||
letter = "x"
|
letter = "a"
|
||||||
message = f"- Warning - Empty 'letter' field for '{eslug}' in multiple-entrance cave '{cave}', setting to {letter}."
|
message = f"- Warning - Empty 'letter' field for '{eslug}' in multiple-entrance cave '{cave}', setting to {letter}."
|
||||||
DataIssue.objects.create(parser="entrances", message=message, url=f"{cave.url}_cave_edit/")
|
#eurl = f"{cave.url}_cave_edit/"
|
||||||
|
eurl = Path(cave.url).parent + f"{cave.slug()}_cave_edit/"
|
||||||
|
# edit recognizer: (?P<path>.*)/(?P<slug>[^/]+)_cave_edit/$
|
||||||
|
DataIssue.objects.create(parser="entrances", message=message, url=eurl)
|
||||||
print(message)
|
print(message)
|
||||||
|
|
||||||
if len(entrances) == 1 and not eslug: # may be empty: <entranceslug></entranceslug>
|
if len(entrances) == 1 and not eslug: # may be empty: <entranceslug></entranceslug>
|
||||||
@ -821,8 +823,7 @@ def read_cave(filename, cave=None):
|
|||||||
cave.extent=extent[0]
|
cave.extent=extent[0]
|
||||||
cave.survex_file=survex_file[0]
|
cave.survex_file=survex_file[0]
|
||||||
cave.description_file=description_file[0]
|
cave.description_file=description_file[0]
|
||||||
# cave.url=url[0]
|
# cave.url=url[0] # set algorithically:
|
||||||
# override url in file. We now have a standard canonical form:
|
|
||||||
cave.url = f"{cave.areacode}/{cave.number()}/{cave.number()}.html"
|
cave.url = f"{cave.areacode}/{cave.number()}/{cave.number()}.html"
|
||||||
check_directory(cave.areacode, cave.number(), cave.url, cave)
|
check_directory(cave.areacode, cave.number(), cave.url, cave)
|
||||||
|
|
||||||
|
@ -137,7 +137,7 @@ def validate_entrance_stations(ent=None):
|
|||||||
"""
|
"""
|
||||||
nonlocal bads
|
nonlocal bads
|
||||||
nonlocal good
|
nonlocal good
|
||||||
# {% url "editentrance" ent.entrance.url_parent cave.slug ent.entrance.slug %}
|
# {% url "editentrance" cave.slug ent.entrance.slug %}
|
||||||
# e.g. url = f"/1623/101/1623-101:{ent}_entrance_edit"
|
# e.g. url = f"/1623/101/1623-101:{ent}_entrance_edit"
|
||||||
cavelist = ent.cavelist()
|
cavelist = ent.cavelist()
|
||||||
if len(cavelist) == 1:
|
if len(cavelist) == 1:
|
||||||
|
@ -137,7 +137,7 @@
|
|||||||
Id letter: '{{ ent.entranceletter|safe}}'
|
Id letter: '{{ ent.entranceletter|safe}}'
|
||||||
{% if ent.entrance.name %}
|
{% if ent.entrance.name %}
|
||||||
{{ ent.entrance.name|safe }}
|
{{ ent.entrance.name|safe }}
|
||||||
{% endif %}<a class="editlink" href="{% if local %}https://expo.survex.com{% endif %}{% url "editentrance" ent.entrance.url_parent cave.slug ent.entrance.slug %}">Edit this entrance</a>
|
{% endif %}<a class="editlink" href="{% if local %}https://expo.survex.com{% endif %}{% url "editentrance" cave.slug ent.entrance.slug %}">Edit this entrance</a>
|
||||||
<dl>
|
<dl>
|
||||||
{% if ent.entrance.marking %}
|
{% if ent.entrance.marking %}
|
||||||
<dt>Marking</dt><dd>{{ ent.entrance.marking_val|safe }}</dd>
|
<dt>Marking</dt><dd>{{ ent.entrance.marking_val|safe }}</dd>
|
||||||
|
2
urls.py
2
urls.py
@ -156,7 +156,7 @@ trogglepatterns = [
|
|||||||
|
|
||||||
# Edit caves and entrances
|
# Edit caves and entrances
|
||||||
re_path(r'^(?P<path>.*)/(?P<slug>[^/]+)_cave_edit/$', edit_cave, name="edit_cave"), # edit_cave needed by cave.html template for url matching
|
re_path(r'^(?P<path>.*)/(?P<slug>[^/]+)_cave_edit/$', edit_cave, name="edit_cave"), # edit_cave needed by cave.html template for url matching
|
||||||
re_path(r'^(?P<path>.*)/(?P<caveslug>[^/]+):(?P<entslug>[^:]+)_entrance_edit', edit_entrance, name = "editentrance"), #edit existing entrance
|
re_path(r'^(?P<caveslug>[^/]+):(?P<entslug>[^:]+)_entrance_edit', edit_entrance, name = "editentrance"), #edit existing entrance
|
||||||
re_path(r'^(?P<path>.*)/(?P<caveslug>[^/]+)_entrance_new$', edit_entrance, name = "newentrance"), # new entrance for a cave
|
re_path(r'^(?P<path>.*)/(?P<caveslug>[^/]+)_entrance_new$', edit_entrance, name = "newentrance"), # new entrance for a cave
|
||||||
|
|
||||||
re_path(r'^(.*)_edit$', editexpopage, name="editexpopage"),
|
re_path(r'^(.*)_edit$', editexpopage, name="editexpopage"),
|
||||||
|
Loading…
Reference in New Issue
Block a user