summaryrefslogtreecommitdiff
path: root/ishtar/furnitures/forms.py
diff options
context:
space:
mode:
Diffstat (limited to 'ishtar/furnitures/forms.py')
-rw-r--r--ishtar/furnitures/forms.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/ishtar/furnitures/forms.py b/ishtar/furnitures/forms.py
index ba3ba826b..780419593 100644
--- a/ishtar/furnitures/forms.py
+++ b/ishtar/furnitures/forms.py
@@ -650,6 +650,7 @@ account_management_wizard = AccountWizard([
class FileWizard(Wizard):
model = models.File
+ object_parcel_type = 'associated_file'
def get_form(self, request, storage, step=None, data=None, files=None):
"""
@@ -710,8 +711,8 @@ class FileWizard(Wizard):
dct['town'] = models.Town.objects.get(pk=int(dct['town']))
except (ValueError, ObjectDoesNotExist):
continue
- dct['associated_file'] = obj
- dct['operation'] = None
+ dct['associated_file'], dct['operation'] = None, None
+ dct[self.object_parcel_type] = obj
if 'DELETE' in dct:
dct.pop('DELETE')
parcel = models.Parcel.objects.filter(**dct).count()
@@ -1144,14 +1145,16 @@ file_administrativeact_deletion_wizard = AdministrativeActDeletionWizard([
FinalAdministrativeActDeleteForm)],
url_name='file_administrativeact_deletion',)
-class OperationWizard(Wizard):
+class OperationWizard(FileWizard):
model = models.Operation
+ object_parcel_type = 'operation'
def process_post_request(self, request, storage, *args, **kwargs):
"""
Change the town (and parcel) form to a free selection town's (parcel's)
form if no archaelogical file is provided
"""
+ #!TODO manage with condition list
file_key = 'general-' + self.url_name + '-associated_file'
if file_key in request.POST.keys():
town_form_key = 'towns-' + self.url_name
@@ -1231,6 +1234,10 @@ class OperationWizard(Wizard):
data, files)
return form
+ def get_extra_model(self, dct, request, storage, form_list):
+ dct['history_modifier'] = request.user
+ return dct
+
def get_form_initial(self, request, storage, step):
initial = super(OperationWizard, self).get_form_initial(request,
storage, step)