diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2023-11-13 18:55:30 +0100 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2023-11-14 16:57:37 +0100 |
commit | d0d146cc099bfe2d58a8c8ec6e57096661d1fdcb (patch) | |
tree | 1007a19ed094bb463a9234909d84412a379a3c9c /ishtar_common/models.py | |
parent | 1d1fd6c794c8ca8e758fc416b43e0f881136057f (diff) | |
download | Ishtar-d0d146cc099bfe2d58a8c8ec6e57096661d1fdcb.tar.bz2 Ishtar-d0d146cc099bfe2d58a8c8ec6e57096661d1fdcb.zip |
⚡️ improve parcel post-treatments - add timestamp to prevent multiple geo and cached_label edition
Diffstat (limited to 'ishtar_common/models.py')
-rw-r--r-- | ishtar_common/models.py | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/ishtar_common/models.py b/ishtar_common/models.py index 75e07d7cb..a1fd5e714 100644 --- a/ishtar_common/models.py +++ b/ishtar_common/models.py @@ -560,6 +560,7 @@ class BulkUpdatedItem(object): :param extra_args: arguments dealing with :return: (transaction ID, is a recursion) """ + # TODO: no more bulk update - should be removed if not transaction_id: transaction_id = str(time.time()) args = ["cached_label_bulk_update", transaction_id] + extra_args @@ -1169,8 +1170,9 @@ class IshtarSiteProfile(models.Model, Cached): ) operation_complete_identifier = models.TextField( _("Operation complete identifier"), - default="", - blank=True, + default="{% if code_patriarche %}OA{{code_patriarche}}{% else %}" + "{% if operation_code and year %}{{year}}-{{operation_code}}" + "{% else %}-{% endif %}{% endif %}", help_text=_("Formula to manage operation complete identifier."), ) operation_custom_index = models.TextField( @@ -1184,8 +1186,8 @@ class IshtarSiteProfile(models.Model, Cached): ) operation_cached_label = models.TextField( _("Operation cached label"), - default="", - blank=True, + default="{{cached_towns_label}} | {% if code_patriarche %}OA{{code_patriarche}}{% else %}" + "{% if operation_code and year %}OP{{year}}-{{operation_code}}{% endif %}{% endif %}", help_text=_( "Formula to manage cached label. If not set a default formula is used." ), @@ -1227,7 +1229,7 @@ class IshtarSiteProfile(models.Model, Cached): _("Archaeological file complete identifier"), default="", blank=True, - help_text=_("Formula to manage archaeological file complete " "identifier."), + help_text=_("Formula to manage archaeological file complete identifier."), ) file_custom_index = models.TextField( _("Archaeological file custom index key"), @@ -1259,8 +1261,8 @@ class IshtarSiteProfile(models.Model, Cached): ) parcel_cached_label = models.TextField( _("Parcel cached label"), - default="", - blank=True, + default="{associated_file__external_id}{operation__complete_identifier} | " + "{town__numero_insee} | {section}{parcel_number}", help_text=_( "Formula to manage cached label. If not set a default formula is used." ), @@ -1292,8 +1294,7 @@ class IshtarSiteProfile(models.Model, Cached): ) contextrecord_cached_label = models.TextField( _("Context record cached label"), - default="", - blank=True, + default="{parcel__cached_label} | {label}", help_text=_( "Formula to manage cached label. If not set a default formula is used." ), @@ -1325,7 +1326,7 @@ class IshtarSiteProfile(models.Model, Cached): ) basefind_cached_label = models.TextField( _("Base find cached label"), - default="", + default="{context_record__cached_label} | {label}", blank=True, help_text=_( "Formula to manage cached label. If not set a default formula is used." @@ -1358,8 +1359,7 @@ class IshtarSiteProfile(models.Model, Cached): ) find_cached_label = models.TextField( _("Find cached label"), - default="", - blank=True, + default="{get_first_base_find__context_record__operation__complete_identifier}-{index:0>5} | {label}", help_text=_( "Formula to manage cached label. If not set a default formula is used." ), |