diff options
| author | Étienne Loks <etienne.loks@proxience.com> | 2015-11-17 22:40:37 +0100 | 
|---|---|---|
| committer | Étienne Loks <etienne.loks@proxience.com> | 2015-11-17 22:40:37 +0100 | 
| commit | c085fb4744d04ea7956a62b9151f62a8008da1d2 (patch) | |
| tree | 3bee2579aad46b25cae3736801d71d2326834d6f /archaeological_finds/models.py | |
| parent | ac268adb38f984041bfab70027a563b5d4c68ad2 (diff) | |
| download | Ishtar-c085fb4744d04ea7956a62b9151f62a8008da1d2.tar.bz2 Ishtar-c085fb4744d04ea7956a62b9151f62a8008da1d2.zip | |
Imports: force re-save on some related models
Diffstat (limited to 'archaeological_finds/models.py')
| -rw-r--r-- | archaeological_finds/models.py | 8 | 
1 files changed, 5 insertions, 3 deletions
| diff --git a/archaeological_finds/models.py b/archaeological_finds/models.py index 479880887..80b2b9074 100644 --- a/archaeological_finds/models.py +++ b/archaeological_finds/models.py @@ -110,6 +110,7 @@ class BaseFind(BaseHistorizedItem, OwnPerms):      index = models.IntegerField(u"Index", default=0)      material_index = models.IntegerField(u"Material index", default=0)      history = HistoricalRecords() +    RELATED_POST_PROCESS = ['find']      class Meta:          verbose_name = _(u"Base find") @@ -152,7 +153,6 @@ class BaseFind(BaseHistorizedItem, OwnPerms):          # OPE|FIND_index          if not self.context_record.operation:              return -        self.get_last_find()          ope = self.context_record.operation          c_id = [unicode(ope.code_patriarche) or                  (unicode(ope.year) + "-" + unicode(ope.operation_code))] @@ -472,7 +472,10 @@ class Find(BaseHistorizedItem, ImageModel, OwnPerms, ShortMenuItem):                  idx = BaseFind.objects\                                .filter(context_record=base_find.context_record)\                                .aggregate(Max('index')) -                base_find.index = idx and idx['index__max'] + 1 or 1 +                base_find.index = 1 +                if idx and idx['index__max']: +                    base_find.index = idx['index__max'] + 1 +                base_find.save()              # if not base_find.material_index:              #    idx = BaseFind.objects\              #                  .filter(context_record=base_find.context_record, @@ -480,7 +483,6 @@ class Find(BaseHistorizedItem, ImageModel, OwnPerms, ShortMenuItem):              #                  .aggregate(Max('material_index'))              #    base_find.material_index = \              #        idx and idx['material_index__max'] + 1 or 1 -            base_find.save()  class FindSource(Source): | 
