From bf0c1161182e905b44a4cb1f17afc9b1f08414c3 Mon Sep 17 00:00:00 2001 From: Cefin Date: Mon, 31 Jan 2022 17:08:43 +0100 Subject: Operation - Parcels - Modify: trying to pass TOWNS data on post request #5227 --- archaeological_operations/views.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'archaeological_operations/views.py') diff --git a/archaeological_operations/views.py b/archaeological_operations/views.py index 2a8207375..faf73826e 100644 --- a/archaeological_operations/views.py +++ b/archaeological_operations/views.py @@ -422,8 +422,14 @@ def operation_modify_parcels(request, pk): if request.method == 'POST': - data = {'TOWNS': available_towns} - formset = formset_class(request.POST, request.FILES, data=data) #DON'T WORK THAT WAY + data = { + 'TOWNS': available_towns, + 'form-TOTAL_FORMS': 1, + 'form-INITIAL_FORMS': 0, + } + request_to_update = request.POST.copy() + + formset = formset_class(request_to_update.update({'TOWNS': available_towns}), request.FILES) #DON'T WORK THAT WAY for form in formset: #DEBUG print(form.errors) #DEBUG -- cgit v1.2.3