summaryrefslogtreecommitdiffstats
path: root/core/forms.py
diff options
context:
space:
mode:
authorPhilip Sargent <philip.sargent@klebos.com>2021-04-21 22:09:20 +0100
committerPhilip Sargent <philip.sargent@klebos.com>2021-04-21 22:09:20 +0100
commit1968db62ad9bdc41f52afc26a8a929f5aeca4a19 (patch)
tree0d8b045ad795e69ae216946d4758ac06f801d5fb /core/forms.py
parentbcdb3572fa260052d76b54961dea9a9381381311 (diff)
downloadtroggle-1968db62ad9bdc41f52afc26a8a929f5aeca4a19.tar.gz
troggle-1968db62ad9bdc41f52afc26a8a929f5aeca4a19.tar.bz2
troggle-1968db62ad9bdc41f52afc26a8a929f5aeca4a19.zip
archeology on the logbook entry editing forms
Diffstat (limited to 'core/forms.py')
-rw-r--r--core/forms.py32
1 files changed, 15 insertions, 17 deletions
diff --git a/core/forms.py b/core/forms.py
index 0ecca73..977e664 100644
--- a/core/forms.py
+++ b/core/forms.py
@@ -93,14 +93,14 @@ class EntranceForm(ModelForm):
return self.cleaned_data
-# This next is called from the templates/edit_cave2.html template.
+# This next line is called from the templates/edit_cave2.html template.
# This is sufficeint to create an entire entry for for the cave fields automatically
# http://localhost:8000/cave/new/
# using django built-in Deep magic. https://docs.djangoproject.com/en/2.2/topics/forms/modelforms/
CaveAndEntranceFormSet = modelformset_factory(CaveAndEntrance, exclude=('cave',))
class EntranceLetterForm(ModelForm):
- '''Can't see what this does at all
+ '''Can't see what this does at all. called twice from views.caves
'''
class Meta:
model = CaveAndEntrance
@@ -148,37 +148,35 @@ def get_name(pe):
class UploadFileForm(forms.Form):
"""Only called by views.others.newFile() which seems to be only about logbook files.
"""
+ title = forms.CharField(max_length=50)
+ file = forms.FileField()
+ #html = forms.CharField(widget=TinyMCE(attrs={'cols': 80, 'rows': 30}))
+ html = forms.CharField(widget=forms.Textarea(attrs={"cols":80, "rows":20}))
+ lon_utm = forms.FloatField(required=False)
+ lat_utm = forms.FloatField(required=False)
+ slug = forms.CharField(max_length=50)
+ date = forms.DateField(required=False)
+ survey_point = forms.CharField()
+
# Because this has EXECUTABLE statements in its signature (the fields) they get
# executed when this module is LOADED. Which barfs horribly.
- # so all replaced by an __init__ method instead.
+ # so all put in an __init__ method instead pending deletion or rewriting
def __init__(self):
- title = forms.CharField(max_length=50)
- file = forms.FileField()
- #html = forms.CharField(widget=TinyMCE(attrs={'cols': 80, 'rows': 30}))
- html = forms.CharField(widget=forms.Textarea(attrs={"cols":80, "rows":20}))
- lon_utm = forms.FloatField(required=False)
- lat_utm = forms.FloatField(required=False)
- slug = forms.CharField(max_length=50)
- date = forms.DateField(required=False)
-
#This next line is the one that causes django.setup() to BARF LOUDLY
caves = [cave.slug for cave in Cave.objects.all()]
#caves.sort() # sort needs rewriting for python3
caves = ["-----"] + caves
cave = forms.ChoiceField([(c, c) for c in caves], required=False)
-
+
entrance = forms.ChoiceField([("-----", "Please select a cave"), ], required=False)
- qm = forms.ChoiceField([("-----", "Please select a cave"), ], required=False)
expeditions = [e.year for e in Expedition.objects.all()]
expeditions.sort()
expeditions = ["-----"] + expeditions
expedition = forms.ChoiceField([(e, e) for e in expeditions], required=False)
+ qm = forms.ChoiceField([("-----", "Please select a cave"), ], required=False)
logbookentry = forms.ChoiceField([("-----", "Please select an expedition"), ], required=False)
-
person = forms.ChoiceField([("-----", "Please select an expedition"), ], required=False)
- survey_point = forms.CharField()
-