diff options
Diffstat (limited to 'archaeological_finds/models_finds.py')
-rw-r--r-- | archaeological_finds/models_finds.py | 52 |
1 files changed, 28 insertions, 24 deletions
diff --git a/archaeological_finds/models_finds.py b/archaeological_finds/models_finds.py index 322cf90e4..465d57f3a 100644 --- a/archaeological_finds/models_finds.py +++ b/archaeological_finds/models_finds.py @@ -213,10 +213,12 @@ post_delete.connect(post_save_cache, sender=CommunicabilityType) class CheckedType(GeneralType): + order = models.IntegerField(_(u"Order"), default=10) + class Meta: verbose_name = _(u"Checked type") verbose_name_plural = _(u"Checked types") - ordering = ('label',) + ordering = ('order',) post_save.connect(post_save_cache, sender=CheckedType) @@ -548,11 +550,6 @@ post_save.connect(post_save_point, sender=BaseFind) WEIGHT_UNIT = (('g', _(u"g")), ('kg', _(u"kg")),) -CHECK_CHOICES = (('NC', _(u"Not checked")), - ('CI', _(u"Checked but incorrect")), - ('CC', _(u"Checked and correct")), - ) - class FindBasket(Basket): items = models.ManyToManyField('Find', blank=True, related_name='basket') @@ -597,7 +594,6 @@ class FBulkView(object): class Find(BulkUpdatedItem, ValueGetter, BaseHistorizedItem, OwnPerms, ShortMenuItem): EXTERNAL_ID_KEY = 'find_external_id' - CHECK_DICT = dict(CHECK_CHOICES) SHOW_URL = 'show-find' SLUG = 'find' TABLE_COLS = ['external_id', 'label', @@ -616,7 +612,7 @@ class Find(BulkUpdatedItem, ValueGetter, BaseHistorizedItem, OwnPerms, 'previous_id', 'label', 'material_types__label', 'datings__period__label', 'find_number', 'object_types__label', 'container__cached_label', - 'container__cahed_location', + 'container__cached_location', 'description', 'base_finds__context_record__town__name', 'base_finds__context_record__parcel', ] @@ -674,20 +670,12 @@ class Find(BulkUpdatedItem, ValueGetter, BaseHistorizedItem, OwnPerms, ] BASE_REQUEST = {'downstream_treatment__isnull': True} EXTRA_REQUEST_KEYS = { - 'base_finds__cache_short_id': - 'base_finds__cache_short_id__icontains', - 'base_finds__cache_complete_id': - 'base_finds__cache_complete_id__icontains', - 'label': - 'label__icontains', 'base_finds__context_record': 'base_finds__context_record__pk', 'base_finds__context_record__archaeological_site': 'base_finds__context_record__archaeological_site__pk', 'archaeological_sites_context_record': 'base_finds__context_record__archaeological_site__pk', - 'base_finds__context_record__town': - 'base_finds__context_record__town__pk', 'base_finds__context_record__operation__year': 'base_finds__context_record__operation__year__contains', 'base_finds__context_record__operation': @@ -729,15 +717,15 @@ class Find(BulkUpdatedItem, ValueGetter, BaseHistorizedItem, OwnPerms, ALT_NAMES = { 'base_finds__cache_short_id': ( pgettext_lazy(TXT_SEARCH_COMMENT, u"short-id"), - 'base_finds__cache_short_id__iexact' + 'base_finds__cache_short_id__contains' ), 'base_finds__cache_complete_id': ( pgettext_lazy(TXT_SEARCH_COMMENT, u"complete-id"), - 'base_finds__cache_complete_id__iexact' + 'base_finds__cache_complete_id__icontains' ), 'label': ( pgettext_lazy(TXT_SEARCH_COMMENT, u"free-id"), - 'label__iexact' + 'label__icontains' ), 'denomination': ( pgettext_lazy(TXT_SEARCH_COMMENT, u"denomination"), @@ -826,12 +814,30 @@ class Find(BulkUpdatedItem, ValueGetter, BaseHistorizedItem, OwnPerms, pgettext_lazy(TXT_SEARCH_COMMENT, u"batch"), 'base_finds__batch__label__iexact', ), - 'checked': ( + 'checked_type': ( pgettext_lazy(TXT_SEARCH_COMMENT, u"checked"), 'checked_type__label__iexact', ), - - + 'documents__image__isnull': ( + pgettext_lazy(TXT_SEARCH_COMMENT, u"has-image"), + 'documents__image__isnull', + ), + 'container__location': ( + pgettext_lazy(TXT_SEARCH_COMMENT, u"location"), + 'container__location__name__iexact', + ), + 'container__responsible': ( + pgettext_lazy(TXT_SEARCH_COMMENT, u"warehouse"), + 'container__responsible__name__iexact', + ), + 'container__index': ( + pgettext_lazy(TXT_SEARCH_COMMENT, u"container-index"), + 'container__index', + ), + 'container__reference': ( + pgettext_lazy(TXT_SEARCH_COMMENT, u"container-ref"), + 'container__reference__iexact', + ), } for v in ALT_NAMES.values(): EXTRA_REQUEST_KEYS[v[0]] = v[1] @@ -925,8 +931,6 @@ class Find(BulkUpdatedItem, ValueGetter, BaseHistorizedItem, OwnPerms, index = models.IntegerField(u"Index", default=0) checked_type = models.ForeignKey(CheckedType, verbose_name=_(u"Check"), blank=True, null=True) - checked = models.CharField(_(u"Check"), max_length=2, default=u'NC', - choices=CHECK_CHOICES) check_date = models.DateField(_(u"Check date"), default=datetime.date.today) estimated_value = models.FloatField(_(u"Estimated value"), blank=True, |