diff options
| author | Cefin <kevon@tuta.io> | 2022-01-21 16:45:45 +0100 | 
|---|---|---|
| committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2022-12-12 12:20:59 +0100 | 
| commit | 86323d5180448f9c72a77ff599598e330838c417 (patch) | |
| tree | 332e7a7809ad9ed3dd4e242fcdaa35ef221eef43 | |
| parent | c5bd2108524cf682f500377330e150d97ed5f2b8 (diff) | |
| download | Ishtar-86323d5180448f9c72a77ff599598e330838c417.tar.bz2 Ishtar-86323d5180448f9c72a77ff599598e330838c417.zip  | |
Operation - Parcels - Modify: draft and attempt for post request (ManagementForm Issue) #5227
| -rw-r--r-- | archaeological_operations/views.py | 12 | 
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)  | 
