forked from expo/troggle
Allow entrances to be edited with the correct parent url. Commit changes to caves when adding a new entrance. Order entrances alphabetically
This commit is contained in:
@@ -116,11 +116,21 @@ class EntranceForm(ModelForm):
|
||||
CaveAndEntranceFormSet = modelformset_factory(CaveAndEntrance, exclude=('cave',))
|
||||
|
||||
class EntranceLetterForm(ModelForm):
|
||||
'''Can't see what this does at all. called twice from views.caves
|
||||
'''Form to link entrances to caves, along with an entrance number.
|
||||
|
||||
Nb. The relationship between caves and entrances has historically been a many to many relationship.
|
||||
With entrances gaining new caves and letters when caves are joined.
|
||||
'''
|
||||
class Meta:
|
||||
model = CaveAndEntrance
|
||||
exclude = ('cave', 'entrance')
|
||||
|
||||
def full_clean(self):
|
||||
super(EntranceLetterForm, self).full_clean()
|
||||
try:
|
||||
self.instance.validate_unique()
|
||||
except forms.ValidationError as e:
|
||||
self._update_errors(e)
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user