mirror of
https://github.com/nottinghamtec/PyRIGS.git
synced 2026-01-16 21:12:13 +00:00
Fix for loosing data when there is a form validation error. Issue #42.
Added info message when there is an validation error and items are not shown.
This commit is contained in:
@@ -23,6 +23,14 @@ class EventForm(forms.ModelForm):
|
||||
|
||||
items = {}
|
||||
|
||||
related_models = {
|
||||
'person': models.Person,
|
||||
'organisation': models.Organisation,
|
||||
'venue': models.Venue,
|
||||
'mic': models.Profile,
|
||||
'checked_in_by': models.Profile,
|
||||
}
|
||||
|
||||
@property
|
||||
def _get_items_json(self):
|
||||
items = {}
|
||||
@@ -37,6 +45,10 @@ class EventForm(forms.ModelForm):
|
||||
|
||||
self.fields['items_json'].initial = self._get_items_json
|
||||
|
||||
def init_items(self):
|
||||
self.items = self.process_items_json()
|
||||
return self.items
|
||||
|
||||
def process_items_json(self, event=None):
|
||||
data = simplejson.loads(self.cleaned_data['items_json'])
|
||||
items = {}
|
||||
|
||||
Reference in New Issue
Block a user