From b316dde25d1258794ce80aafc9640ff849e6fa1a Mon Sep 17 00:00:00 2001 From: David Taylor Date: Fri, 28 Aug 2015 00:12:29 +0100 Subject: [PATCH] Added comments to EventItem creation --- RIGS/forms.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/RIGS/forms.py b/RIGS/forms.py index 7c18d0d2..922558c3 100644 --- a/RIGS/forms.py +++ b/RIGS/forms.py @@ -87,8 +87,13 @@ class EventForm(forms.ModelForm): try: item = models.EventItem.objects.get(pk=pk,event=event) except models.EventItem.DoesNotExist: + # This occurs for one of two reasons + # 1) The event has been duplicated, so the item PKs belong to another event + # 2) The items are brand new, with negative PK values + # In either case, we want to create the items item = models.EventItem() + # Take the data from the form and update the item object item.name = data['name'] item.description = data['description'] item.quantity = data['quantity']