diff options
Diffstat (limited to 'archaeological_finds/models.py')
| -rw-r--r-- | archaeological_finds/models.py | 13 | 
1 files changed, 8 insertions, 5 deletions
| diff --git a/archaeological_finds/models.py b/archaeological_finds/models.py index 36702b707..03e54b8f2 100644 --- a/archaeological_finds/models.py +++ b/archaeological_finds/models.py @@ -89,7 +89,7 @@ class ObjectType(GeneralType):  class BaseFind(BaseHistorizedItem, OwnPerms): -    label = models.CharField(_(u"ID"), max_length=60) +    label = models.CharField(_(u"Free-ID"), max_length=60)      external_id = models.CharField(_(u"External ID"), blank=True, null=True,                                     max_length=120)      description = models.TextField(_(u"Description"), blank=True, null=True) @@ -218,7 +218,7 @@ class Find(BaseHistorizedItem, ImageModel, OwnPerms, ShortMenuItem):      external_id = models.CharField(_(u"External ID"), blank=True, null=True,                                     max_length=120)      order = models.IntegerField(_(u"Order"), default=1) -    label = models.CharField(_(u"ID"), max_length=60) +    label = models.CharField(_(u"Free-ID"), max_length=60)      description = models.TextField(_(u"Description"), blank=True, null=True)      material_types = models.ManyToManyField(          MaterialType, verbose_name=_(u"Material types"), related_name='finds') @@ -386,11 +386,13 @@ class Find(BaseHistorizedItem, ImageModel, OwnPerms, ShortMenuItem):          return q.filter(downstream_treatment__isnull=True).count()      def duplicate(self, user): +        # TODO +        raise          dct = dict([(attr, getattr(self, attr)) for attr in                      ('order', 'label', 'description',                       'volume', 'weight', 'find_number', 'dating',                       'conservatory_state', 'preservation_to_consider', -                     'weight_unit', 'find_number')]) +                     'weight_unit', )])          dct['order'] += 1          dct['history_modifier'] = user          new = self.__class__(**dct) @@ -403,8 +405,9 @@ class Find(BaseHistorizedItem, ImageModel, OwnPerms, ShortMenuItem):          super(Find, self).save(*args, **kwargs)          q = self.base_finds          if not self.index and q.count(): -            # TODO: which base_find to take? -            operation = q.all()[0].context_record.operation +            operation = q.order_by( +                '-context_record__operation__start_date')\ +                .all()[0].context_record.operation              q = Find.objects\                  .filter(base_finds__context_record__operation=operation)              if self.pk: | 
