diff options
author | Étienne Loks <etienne.loks@proxience.com> | 2015-07-10 21:54:31 +0200 |
---|---|---|
committer | Étienne Loks <etienne.loks@proxience.com> | 2015-07-10 21:54:31 +0200 |
commit | 96ad8d81594a31502bb0b0473876482e8b053f9e (patch) | |
tree | 23dedcb8264d623308e2463c50c682a7216929a9 /archaeological_operations/wizards.py | |
parent | 6f50ea8965abd59e91e18390dd6305635a9fc3d7 (diff) | |
parent | efdc0e0fd8c8d128b75b6ea8516d2ba79545413f (diff) | |
download | Ishtar-96ad8d81594a31502bb0b0473876482e8b053f9e.tar.bz2 Ishtar-96ad8d81594a31502bb0b0473876482e8b053f9e.zip |
Merge branch 'stable'
Conflicts:
ishtar_common/templates/ishtar/wizard/parcels_wizard.html
Diffstat (limited to 'archaeological_operations/wizards.py')
-rw-r--r-- | archaeological_operations/wizards.py | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/archaeological_operations/wizards.py b/archaeological_operations/wizards.py index 01e717b18..9e6b9d03a 100644 --- a/archaeological_operations/wizards.py +++ b/archaeological_operations/wizards.py @@ -88,6 +88,10 @@ class OperationWizard(Wizard): elif step.startswith('parcels-') and self.get_current_file(): # if a file is acciated to the operation add the button "Add all" context['add_all'] = True + if step.startswith('parcels') and\ + hasattr(self, 'automatic_parcel_association'): + context['automatic_parcel_association'] = \ + self.automatic_parcel_association # reminder of the current file reminder = self.get_reminder() if reminder: @@ -111,6 +115,7 @@ class OperationWizard(Wizard): return sorted(towns, key=lambda x:x[1]) def get_available_parcels(self, file): + self.automatic_parcel_association = False parcels = [] current_parcels = [] operation = self.get_current_object() @@ -121,10 +126,14 @@ class OperationWizard(Wizard): parcels.append((parcel.pk, parcel.short_label)) try: for parcel in file.parcels.all(): - if (parcel.town, parcel.section, parcel.parcel_number) \ - in current_parcels: + key = (parcel.town, parcel.section, parcel.parcel_number) + if key in current_parcels: + current_parcels.pop(current_parcels.index(key)) continue parcels.append((parcel.pk, parcel.short_label)) + if current_parcels: + # not all operation parcel exist for the file + self.automatic_parcel_association = True except (ValueError, ObjectDoesNotExist): pass return sorted(parcels, key=lambda x:x[1]) |