diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2020-11-17 15:37:22 +0100 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2021-02-28 12:15:21 +0100 |
commit | 4fa501cb189c61d94a2ca53a604f3db7a212153c (patch) | |
tree | e983fd246f6fd2ce0e9521ea23c1f93c73cc8bc9 /archaeological_finds | |
parent | a255ff5f509225c3258aa9546d9cbd4ce0c0fa0b (diff) | |
download | Ishtar-4fa501cb189c61d94a2ca53a604f3db7a212153c.tar.bz2 Ishtar-4fa501cb189c61d94a2ca53a604f3db7a212153c.zip |
Manage a "custom_index" for base types
Diffstat (limited to 'archaeological_finds')
-rw-r--r-- | archaeological_finds/migrations/0107_auto_20201117_0759.py | 35 | ||||
-rw-r--r-- | archaeological_finds/models_finds.py | 11 |
2 files changed, 46 insertions, 0 deletions
diff --git a/archaeological_finds/migrations/0107_auto_20201117_0759.py b/archaeological_finds/migrations/0107_auto_20201117_0759.py new file mode 100644 index 000000000..c451c601a --- /dev/null +++ b/archaeological_finds/migrations/0107_auto_20201117_0759.py @@ -0,0 +1,35 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.27 on 2020-11-17 07:59 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('archaeological_finds', '0106_auto_20201104_1000'), + ] + + operations = [ + migrations.AddField( + model_name='basefind', + name='custom_index', + field=models.IntegerField(blank=True, null=True, verbose_name='Custom index'), + ), + migrations.AddField( + model_name='find', + name='custom_index', + field=models.IntegerField(blank=True, null=True, verbose_name='Custom index'), + ), + migrations.AddField( + model_name='historicalbasefind', + name='custom_index', + field=models.IntegerField(blank=True, null=True, verbose_name='Custom index'), + ), + migrations.AddField( + model_name='historicalfind', + name='custom_index', + field=models.IntegerField(blank=True, null=True, verbose_name='Custom index'), + ), + ] diff --git a/archaeological_finds/models_finds.py b/archaeological_finds/models_finds.py index a9f554380..9b1f43cb6 100644 --- a/archaeological_finds/models_finds.py +++ b/archaeological_finds/models_finds.py @@ -343,6 +343,10 @@ class BaseFind(BulkUpdatedItem, BaseHistorizedItem, GeoItem, def natural_key(self): return (self.uuid, ) + @property + def operation(self): + return self.context_record.operation + def public_representation(self): dct = super(BaseFind, self).public_representation() dct.update({ @@ -1853,6 +1857,13 @@ class Find(BulkUpdatedItem, ValueGetter, DocumentItem, BaseHistorizedItem, bf.context_record.operation.get_reference(), self.index) + @property + def operation(self): + bf = self.get_first_base_find() + if not bf or not bf.context_record or not bf.context_record.operation: + return + return bf.context_record.operation + def context_records_lbl(self): return " - ".join( [bf.context_record.cached_label for bf in self.base_finds.all()] |