diff options
author | Étienne Loks <etienne.loks@proxience.com> | 2015-10-01 16:06:31 +0200 |
---|---|---|
committer | Étienne Loks <etienne.loks@proxience.com> | 2015-10-01 16:06:31 +0200 |
commit | 1897abe3eac99bc9d10cb40d3664b7ef0ad64b79 (patch) | |
tree | 2aa7d8461254405ed5c6185776b9fc7dbb38f384 /archaeological_finds | |
parent | b5057a03ee4fc20a5fe77fe7c29ff91b16ed9d3c (diff) | |
download | Ishtar-1897abe3eac99bc9d10cb40d3664b7ef0ad64b79.tar.bz2 Ishtar-1897abe3eac99bc9d10cb40d3664b7ef0ad64b79.zip |
Finds: change labels - better management of index
Diffstat (limited to 'archaeological_finds')
-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 %} |