diff options
| -rw-r--r-- | archaeological_operations/wizards.py | 13 | ||||
| -rw-r--r-- | ishtar_common/static/media/style.css | 4 | ||||
| -rw-r--r-- | ishtar_common/templates/ishtar/wizard/parcels_wizard.html | 1 | 
3 files changed, 16 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]) diff --git a/ishtar_common/static/media/style.css b/ishtar_common/static/media/style.css index 0505e21a5..a00fce2cf 100644 --- a/ishtar_common/static/media/style.css +++ b/ishtar_common/static/media/style.css @@ -860,6 +860,10 @@ p.alert{      background-position:left center;  } +div.form p.alert{ +    background-color:#FFF; +} +  #window p.alert{      background-color:#EEE;  } diff --git a/ishtar_common/templates/ishtar/wizard/parcels_wizard.html b/ishtar_common/templates/ishtar/wizard/parcels_wizard.html index ce2bc9780..5afa69360 100644 --- a/ishtar_common/templates/ishtar/wizard/parcels_wizard.html +++ b/ishtar_common/templates/ishtar/wizard/parcels_wizard.html @@ -9,6 +9,7 @@  {{ wizard.form.media }}  {{ wizard.management_form }}    {{ wizard.form.management_form }} +{% if automatic_parcel_association %}<p class='alert'><label>{%trans "Existing parcels from the operation will be automatically added to the archaeological file." %}</label></p>{% endif %}    {%if wizard.form.non_form_errors%}  <table class='formset'>  <tr class='error'><th colspan='2'>{{wizard.form.non_form_errors}}</th></tr> | 
