diff options
Diffstat (limited to 'ishtar_common/models.py')
| -rw-r--r-- | ishtar_common/models.py | 51 | 
1 files changed, 50 insertions, 1 deletions
| diff --git a/ishtar_common/models.py b/ishtar_common/models.py index bba04488b..6e8e0409e 100644 --- a/ishtar_common/models.py +++ b/ishtar_common/models.py @@ -808,11 +808,20 @@ class IshtarSiteProfile(models.Model, Cached):          _("Operation complete identifier"),          default="",          help_text=_("Formula to manage operation complete identifier.")) +    operation_custom_index = models.TextField( +        _("Operation custom index key"), +        default="", +        help_text=_("Key to be used to manage operation custom index."))      site_complete_identifier = models.TextField(          _("Archaeological site complete identifier"),          default="",          help_text=_("Formula to manage archaeological site complete"                      " identifier.")) +    site_custom_index = models.TextField( +        _("Archaeological site custom index key"), +        default="", +        help_text=_("Key to be used to manage archaeological site custom" +                    " index."))      file_external_id = models.TextField(          _("File external id"),          default="{year}-{numeric_reference}", @@ -825,6 +834,11 @@ class IshtarSiteProfile(models.Model, Cached):          default="",          help_text=_("Formula to manage archaeological file complete "                      "identifier.")) +    file_custom_index = models.TextField( +        _("Archaeological file custom index key"), +        default="", +        help_text=_("Key to be used to manage archaeological file custom " +                    "index."))      parcel_external_id = models.TextField(          _("Parcel external id"),          default="{associated_file__external_id}{operation__code_patriarche}-" @@ -840,10 +854,14 @@ class IshtarSiteProfile(models.Model, Cached):                      "Change this with care. With incorrect formula, the "                      "application might be unusable and import of external "                      "data can be destructive.")) -    context_record_complete_identifier = models.TextField( +    contextrecord_complete_identifier = models.TextField(          _("Context record complete identifier"),          default="",          help_text=_("Formula to manage context record complete identifier.")) +    contextrecord_custom_index = models.TextField( +        _("Context record custom index key"), +        default="", +        help_text=_("Key to be used to manage context record custom index."))      base_find_external_id = models.TextField(          _("Base find external id"),          default="{context_record__external_id}-{label}", @@ -855,6 +873,10 @@ class IshtarSiteProfile(models.Model, Cached):          _("Base find complete identifier"),          default="",          help_text=_("Formula to manage base find complete identifier.")) +    basefind_custom_index = models.TextField( +        _("Base find custom index key"), +        default="", +        help_text=_("Key to be used to manage base find custom index."))      find_external_id = models.TextField(          _("Find external id"),          default="{get_first_base_find__context_record__external_id}-{label}", @@ -866,6 +888,10 @@ class IshtarSiteProfile(models.Model, Cached):          _("Find complete identifier"),          default="",          help_text=_("Formula to manage find complete identifier.")) +    find_custom_index = models.TextField( +        _("Find custom index key"), +        default="", +        help_text=_("Key to be used to manage find custom index."))      container_external_id = models.TextField(          _("Container external id"),          default="{parent_external_id}-{container_type__txt_idx}-" @@ -878,6 +904,10 @@ class IshtarSiteProfile(models.Model, Cached):          _("Container complete identifier"),          default="",          help_text=_("Formula to manage container complete identifier.")) +    container_custom_index = models.TextField( +        _("Container custom index key"), +        default="", +        help_text=_("Key to be used  to manage container custom index."))      warehouse_external_id = models.TextField(          _("Warehouse external id"),          default="{name|slug}", @@ -889,6 +919,10 @@ class IshtarSiteProfile(models.Model, Cached):          _("Warehouse complete identifier"),          default="",          help_text=_("Formula to manage warehouse complete identifier.")) +    warehouse_custom_index = models.TextField( +        _("Warehouse custom index key"), +        default="", +        help_text=_("Key to be used to manage warehouse custom index."))      document_external_id = models.TextField(          _("Document external id"),          default="{index}", @@ -900,6 +934,10 @@ class IshtarSiteProfile(models.Model, Cached):          _("Document complete identifier"),          default="",          help_text=_("Formula to manage document complete identifier.")) +    document_custom_index = models.TextField( +        _("Document custom index key"), +        default="", +        help_text=_("Key to be used to manage document custom index."))      person_raw_name = models.TextField(          _("Raw name for person"),          default="{name|upper} {surname}", @@ -3036,6 +3074,17 @@ class Document(BaseHistorizedItem, CompleteIdentifierItem, OwnPerms, ImageModel,      def __str__(self):          return self.title +    def get_index_operation(self): +        current_operation = None +        ope_nb = self.operations.count() +        if ope_nb > 1: +            return +        elif ope_nb == 1: +            key = 'operations__pk' +        cr_nb = self.context_records.count() +        if cr_nb: +            self.context_records +      def natural_key(self):          return (self.external_id,) | 
