summaryrefslogtreecommitdiff
path: root/archaeological_operations/views.py
diff options
context:
space:
mode:
authorCefin <kevon@tuta.io>2022-01-21 16:45:45 +0100
committerÉtienne Loks <etienne.loks@iggdrasil.net>2022-12-12 12:20:59 +0100
commite9e325cf16334c3fd580647e1561a4a559584148 (patch)
tree332e7a7809ad9ed3dd4e242fcdaa35ef221eef43 /archaeological_operations/views.py
parentf613896e19caaa1f2884f480d1408f8c8ec01843 (diff)
downloadIshtar-e9e325cf16334c3fd580647e1561a4a559584148.tar.bz2
Ishtar-e9e325cf16334c3fd580647e1561a4a559584148.zip
Operation - Parcels - Modify: draft and attempt for post request (ManagementForm Issue) #5227
Diffstat (limited to 'archaeological_operations/views.py')
-rw-r--r--archaeological_operations/views.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/archaeological_operations/views.py b/archaeological_operations/views.py
index d6ebd940c..da46d9e17 100644
--- a/archaeological_operations/views.py
+++ b/archaeological_operations/views.py
@@ -421,9 +421,17 @@ def operation_modify_parcels(request, pk):
if request.method == 'POST': #TODO
print(request.POST)
- formset = formset_class(request.POST or None, request.FILES or None)
+ # formset = formset_class(request.POST or None, request.FILES or None)
if formset.is_valid():
print(formset.cleaned_data)
+ post_data = request.POST.copy()
+
+ for key in post_data.keys():
+ if key.endswith("-DELETE"):
+ post_data.pop(key)
+
+ request.POST = post_data
+ formset_class(request.POST).save()
else:
formset = formset_class()
else:
@@ -443,6 +451,8 @@ def operation_modify_parcels(request, pk):
'TOWNS': available_towns,
'form-TOTAL_FORMS': len(initial),
'form-INITIAL_FORMS': 0,
+ 'form-MIN_NUM_FORMS': 0,
+ 'form-MAX_NUM_FORMS': 100,
}
formset = formset_class(initial=initial, data=data)