mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2025-12-14 20:27:10 +00:00
debugging Cave page links..
This commit is contained in:
@@ -25,7 +25,7 @@ todo = """
|
||||
|
||||
class CaveForm(ModelForm):
|
||||
"""Only those fields for which we want to override defaults are listed here
|
||||
the other fields are present on the form, but use the default presentation style
|
||||
the other fields of the class Cave are present on the form, but use the default presentation style
|
||||
"""
|
||||
|
||||
official_name = forms.CharField(required=False, widget=forms.TextInput(attrs={"size": "45"}))
|
||||
@@ -74,19 +74,11 @@ class CaveForm(ModelForm):
|
||||
model = Cave
|
||||
exclude = ("filename",)
|
||||
|
||||
field_order = ['area', 'unofficial_number', 'kataster_number', 'official_name', 'underground_description', 'explorers', 'equipment', 'survey', 'kataster_status', 'underground_centre_line', 'notes', 'references', 'description_file', 'survex_file', 'url', 'length', 'depth', 'extent']
|
||||
|
||||
def get_area(self):
|
||||
for a in self.cleaned_data["area"]:
|
||||
if a.kat_area():
|
||||
return a.kat_area()
|
||||
|
||||
field_order = ['unofficial_number', 'kataster_number', 'official_name', 'underground_description', 'explorers', 'equipment', 'survey', 'kataster_status', 'kataster_code','underground_centre_line', 'notes', 'references', 'description_file', 'survex_file', 'areacode', 'url', 'length', 'depth', 'extent']
|
||||
|
||||
def clean_cave_slug(self):
|
||||
if self.cleaned_data["cave_slug"] == "":
|
||||
myArea = ""
|
||||
for a in self.cleaned_data["area"]:
|
||||
if a.kat_area():
|
||||
myArea = a.kat_area()
|
||||
myArea = self.cleaned_data["areacode"]
|
||||
if self.data["kataster_number"]:
|
||||
cave_slug = f"{myArea}-{self.cleaned_data['kataster_number']}"
|
||||
else:
|
||||
@@ -112,8 +104,8 @@ class CaveForm(ModelForm):
|
||||
)
|
||||
# if self.cleaned_data.get("kataster_number") != "" and self.cleaned_data.get("official_name") == "":
|
||||
# self._errors["official_name"] = self.error_class(["This field is required when there is a kataster number."])
|
||||
if cleaned_data.get("area") == []:
|
||||
self._errors["area"] = self.error_class(["This field is required."])
|
||||
if cleaned_data.get("url") == []:
|
||||
self._errors["url"] = self.error_class(["This field is required."])
|
||||
if cleaned_data.get("url") and cleaned_data.get("url").startswith("/"):
|
||||
self._errors["url"] = self.error_class(["This field cannot start with a /."])
|
||||
return cleaned_data
|
||||
|
||||
Reference in New Issue
Block a user