From 3aef004ba3e45818e6d4b907cf35d54bdbd0f3bf Mon Sep 17 00:00:00 2001 From: Malabika Sen Date: Thu, 28 Apr 2016 10:59:50 +0530 Subject: [PATCH] Retains end date in event edit on erroneus entry As per issue [#307](https://github.com/systers/vms/issues/307) , the `end-date` field would go blank after saving the form with blank `start-date` field (which goes blank on an erroneous entry). This PR resolves the issue by retaining all the entries of the field including the `end-date` field. --- vms/event/views.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/vms/event/views.py b/vms/event/views.py index 64b3586..32eef2b 100644 --- a/vms/event/views.py +++ b/vms/event/views.py @@ -93,6 +93,9 @@ def edit(request, event_id): form.save() return HttpResponseRedirect(reverse('event:list')) else: + data = request.POST.copy() + data['end_date'] = form.cleaned_data['end_date'] + form = EventForm(data) return render(request, 'event/edit.html', {'form': form, }) else: form = EventForm(instance=event)