diff options
| -rw-r--r-- | archaeological_finds/forms.py | 6 | ||||
| -rw-r--r-- | archaeological_finds/models.py | 13 | ||||
| -rw-r--r-- | archaeological_finds/templates/ishtar/sheet_find.html | 2 | 
3 files changed, 13 insertions, 8 deletions
| diff --git a/archaeological_finds/forms.py b/archaeological_finds/forms.py index 764ef72a2..76337b5ac 100644 --- a/archaeological_finds/forms.py +++ b/archaeological_finds/forms.py @@ -48,7 +48,8 @@ class FindForm(forms.Form):                           'conservatory_state': models.ConservatoryState,                           'object_type': models.ObjectType}      label = forms.CharField( -        label=_(u"ID"), validators=[validators.MaxLengthValidator(60)]) +        label=_(u"Free-ID"), +        validators=[validators.MaxLengthValidator(60)])      description = forms.CharField(label=_("Description"),                                    widget=forms.Textarea, required=False)      base_finds__is_isolated = forms.NullBooleanField( @@ -240,7 +241,8 @@ class ResultFindForm(forms.Form):      form_label = _(u"Resulting find")      associated_models = {'material_type': models.MaterialType}      label = forms.CharField( -        label=_(u"ID"), validators=[validators.MaxLengthValidator(60)]) +        label=_(u"Free-ID"), +        validators=[validators.MaxLengthValidator(60)])      description = forms.CharField(label=_(u"Precise description"),                                    widget=forms.Textarea)      material_type = forms.ChoiceField(label=_(u"Material type"), choices=[]) 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: diff --git a/archaeological_finds/templates/ishtar/sheet_find.html b/archaeological_finds/templates/ishtar/sheet_find.html index cf3a0bb44..df29cb037 100644 --- a/archaeological_finds/templates/ishtar/sheet_find.html +++ b/archaeological_finds/templates/ishtar/sheet_find.html @@ -28,7 +28,7 @@  <a href='{{item.image.url}}' rel="prettyPhoto" title="{{item.label}}"><img src='{{item.thumbnail.url}}'/></a>  {% endif%} -{% field "Name" item.label %} +{% field "Free-ID" item.label %}  {% field "Description" item.description %}  {% field "Created by" item.history_creator.ishtaruser.full_label %}  {% field "Administrative index" item.administrative_index %} | 
