diff options
| -rw-r--r-- | archaeological_operations/models.py | 18 | ||||
| -rw-r--r-- | archaeological_operations/templates/ishtar/sheet_operation.html | 7 | 
2 files changed, 20 insertions, 5 deletions
| diff --git a/archaeological_operations/models.py b/archaeological_operations/models.py index 37c9305e9..f5a1ca8b0 100644 --- a/archaeological_operations/models.py +++ b/archaeological_operations/models.py @@ -194,7 +194,7 @@ class Operation(ClosedItem, BaseHistorizedItem, ImageModel, OwnPerms,                                    on_delete=models.SET_NULL,                                    related_name='operation_responsability')      year = models.IntegerField(_(u"Year"), null=True, blank=True) -    operation_code = models.IntegerField(_(u"Operation code"), null=True, +    operation_code = models.IntegerField(_(u"Numeric reference"), null=True,                                           blank=True)      associated_file = models.ForeignKey(          'archaeological_files.File', @@ -473,6 +473,7 @@ class Operation(ClosedItem, BaseHistorizedItem, ImageModel, OwnPerms,      @property      def nb_parcels(self): +        _(u"Number of parcels")          nb = 0          if self.associated_file:              nb = self.associated_file.parcels.count() @@ -523,7 +524,7 @@ class Operation(ClosedItem, BaseHistorizedItem, ImageModel, OwnPerms,          for res in q.all():              nbs.append((unicode(res['unit__label']),                          self.context_record.filter(unit=res['unit']).count())) -        return nbs +        return list(set(nbs))      @property      def nb_context_records_by_periods(self, update=False): @@ -548,7 +549,8 @@ class Operation(ClosedItem, BaseHistorizedItem, ImageModel, OwnPerms,      def _nb_finds(self):          from archaeological_finds.models import Find          q = Find.objects.filter( -            base_finds__context_record__operation=self) +            base_finds__context_record__operation=self, +            upstream_treatment_id__isnull=True).distinct()          return q.count()      @property @@ -559,13 +561,16 @@ class Operation(ClosedItem, BaseHistorizedItem, ImageModel, OwnPerms,          from archaeological_finds.models import Find          nbs = []          q = Find.objects.filter( -            base_finds__context_record__operation=self).values( +            upstream_treatment_id__isnull=True, +            base_finds__context_record__operation=self).distinct().values(              'material_types__pk', 'material_types__label').distinct().order_by(              'material_types__label')          for res in q.all():              nbs.append(                  (unicode(res['material_types__label']),                   Find.objects.filter( +                    base_finds__context_record__operation=self, +                    upstream_treatment_id__isnull=True,                      material_types__pk=res['material_types__pk']).count()))          return nbs @@ -587,6 +592,8 @@ class Operation(ClosedItem, BaseHistorizedItem, ImageModel, OwnPerms,              nbs.append(                  (label,                   Find.objects.filter( +                     base_finds__context_record__operation=self, +                     upstream_treatment_id__isnull=True,                       object_types=res['object_types']).count()))          return nbs @@ -605,6 +612,8 @@ class Operation(ClosedItem, BaseHistorizedItem, ImageModel, OwnPerms,              nbs.append(                  (unicode(res['datings__period__label']),                   Find.objects.filter( +                    base_finds__context_record__operation=self, +                    upstream_treatment_id__isnull=True,                      datings__period=res['datings__period']).count()))          return nbs @@ -636,6 +645,7 @@ class Operation(ClosedItem, BaseHistorizedItem, ImageModel, OwnPerms,              self.source,              ContextRecordSource.objects.filter(context_record__operation=self),              FindSource.objects.filter( +                find__upstream_treatment_id__isnull=True,                  find__base_finds__context_record__operation=self)]          for q in qs:              for res in q.values('source_type').distinct(): diff --git a/archaeological_operations/templates/ishtar/sheet_operation.html b/archaeological_operations/templates/ishtar/sheet_operation.html index 5efd0c2b7..2f6dbdf4c 100644 --- a/archaeological_operations/templates/ishtar/sheet_operation.html +++ b/archaeological_operations/templates/ishtar/sheet_operation.html @@ -21,7 +21,7 @@  <ul class='form-flex'>  {% field_li "Name" item.common_name %}  {% field_li "Year" item.year %} -{% field_li "Numerical reference" item.operation_code %} +{% field_li "Numeric reference" item.operation_code %}  {% field_li "Code patriarche" item.code_patriarche 'OA' %}  {% field_li "Old code" item.old_code %}  <li><label>{%trans "Last modification date:"%}</label> <span class='value'>{% if item.history_date %}{{ item.history_date }}{% else %}{{ item.history.all.0.history_date }}{% endif %}</span></li> <!-- date = now --> @@ -135,6 +135,11 @@  {% field_li "Number of indexed administrative acts" item.nb_indexed_acts %}  </ul> +<h4>{% trans "Parcels" %}</h4> +<ul class='form-flex'> +{% field_li "Number of parcels" item.nb_parcels %} +</ul> +  <h4>{% trans "Context records" %}</h4>  <ul class='form-flex'>  {% field_li "Number of context records" item.nb_context_records %} | 
