mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2025-12-14 21:57:09 +00:00
archeology on the logbook entry editing forms
This commit is contained in:
@@ -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()
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user