diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2023-01-27 17:31:00 +0100 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2023-01-27 17:31:00 +0100 |
commit | dc1d0da3544d2ec9adb4c792c357fe06eaf752a7 (patch) | |
tree | dc2627a86507fe03bf42b21bcc5fe21183573cf4 /archaeological_warehouse | |
parent | e448e19f9a472f8bb9ce41b085d175e91e0b873b (diff) | |
download | Ishtar-dc1d0da3544d2ec9adb4c792c357fe06eaf752a7.tar.bz2 Ishtar-dc1d0da3544d2ec9adb4c792c357fe06eaf752a7.zip |
Add custom cached_label configuration for each main item
Diffstat (limited to 'archaeological_warehouse')
-rw-r--r-- | archaeological_warehouse/migrations/0116_auto_20230127_1504.py | 28 | ||||
-rw-r--r-- | archaeological_warehouse/models.py | 6 |
2 files changed, 31 insertions, 3 deletions
diff --git a/archaeological_warehouse/migrations/0116_auto_20230127_1504.py b/archaeological_warehouse/migrations/0116_auto_20230127_1504.py new file mode 100644 index 000000000..1134ef921 --- /dev/null +++ b/archaeological_warehouse/migrations/0116_auto_20230127_1504.py @@ -0,0 +1,28 @@ +# Generated by Django 2.2.24 on 2023-01-27 15:04 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('archaeological_warehouse', '0115_auto_20230120_1133'), + ] + + operations = [ + migrations.AddField( + model_name='historicalwarehouse', + name='cached_label', + field=models.TextField(blank=True, db_index=True, default='', help_text='Generated automatically - do not edit', verbose_name='Cached name'), + ), + migrations.AddField( + model_name='warehouse', + name='cached_label', + field=models.TextField(blank=True, db_index=True, default='', help_text='Generated automatically - do not edit', verbose_name='Cached name'), + ), + migrations.AlterField( + model_name='container', + name='cached_label', + field=models.TextField(blank=True, db_index=True, default='', help_text='Generated automatically - do not edit', verbose_name='Cached name'), + ), + ] diff --git a/archaeological_warehouse/models.py b/archaeological_warehouse/models.py index 4fcb1b1d7..224fe8b21 100644 --- a/archaeological_warehouse/models.py +++ b/archaeological_warehouse/models.py @@ -1123,9 +1123,6 @@ class Container( ) reference = models.TextField(_("Container ref.")) comment = models.TextField(_("Comment"), blank=True, default="") - cached_label = models.TextField( - _("Localisation"), blank=True, default="", db_index=True - ) cached_location = models.TextField( _("Cached location"), blank=True, default="", db_index=True ) @@ -1309,6 +1306,9 @@ class Container( context.pop(k) def _generate_cached_label(self): + label = self._profile_generate_cached_label() + if label: + return label return self.precise_location def _generate_cached_location(self): |