diff options
Diffstat (limited to 'archaeological_context_records')
| -rw-r--r-- | archaeological_context_records/migrations/0101_squashed.py | 3 | ||||
| -rw-r--r-- | archaeological_context_records/models.py | 13 | 
2 files changed, 10 insertions, 6 deletions
diff --git a/archaeological_context_records/migrations/0101_squashed.py b/archaeological_context_records/migrations/0101_squashed.py index fcdf81789..119e28b61 100644 --- a/archaeological_context_records/migrations/0101_squashed.py +++ b/archaeological_context_records/migrations/0101_squashed.py @@ -111,8 +111,7 @@ class Migration(migrations.Migration):                  'ordering': ('cached_label',),                  'permissions': (('view_own_contextrecord', 'Can view own Context Record'), ('add_own_contextrecord', 'Can add own Context Record'), ('change_own_contextrecord', 'Can change own Context Record'), ('delete_own_contextrecord', 'Can delete own Context Record')),              }, -            bases=(ishtar_common.models.BulkUpdatedItem, -                   ishtar_common.models.DocumentItem, +            bases=(ishtar_common.models.DocumentItem,                     ishtar_common.models.StatisticItem,                     ishtar_common.models.TemplateItem,                     ishtar_common.models.OwnPerms, diff --git a/archaeological_context_records/models.py b/archaeological_context_records/models.py index e13633d90..0ac13e43a 100644 --- a/archaeological_context_records/models.py +++ b/archaeological_context_records/models.py @@ -52,7 +52,6 @@ from ishtar_common.models import (      post_delete_record_relation,      post_save_cache,      ValueGetter, -    BulkUpdatedItem,      RelationItem,      Town,      get_current_profile, @@ -461,7 +460,6 @@ class GeographicSubTownItem(GeoItem):  class ContextRecord( -    BulkUpdatedItem,      DocumentItem,      BaseHistorizedItem,      CompleteIdentifierItem, @@ -1286,8 +1284,15 @@ def context_record_post_save(sender, **kwargs):      cached_label_changed(sender=sender, **kwargs)      post_save_geo(sender=sender, **kwargs)      instance = kwargs.get("instance", None) -    if instance and instance.pk: -        ContextRecordTree.update(instance.pk) +    if not instance or not instance.pk: +        return +    ContextRecordTree.update(instance.pk) +    BaseFind = apps.get_model("archaeological_finds", "BaseFind") +    Find = apps.get_model("archaeological_finds", "Find") +    for bf in instance.base_finds.all(): +        cached_label_changed(BaseFind, instance=bf) +        for f in bf.find.all(): +            cached_label_changed(Find, instance=f)  post_save.connect(context_record_post_save, sender=ContextRecord)  | 
