summaryrefslogtreecommitdiff
path: root/archaeological_finds/models_finds.py
diff options
context:
space:
mode:
Diffstat (limited to 'archaeological_finds/models_finds.py')
-rw-r--r--archaeological_finds/models_finds.py38
1 files changed, 26 insertions, 12 deletions
diff --git a/archaeological_finds/models_finds.py b/archaeological_finds/models_finds.py
index be6037eaa..e1fcb38b7 100644
--- a/archaeological_finds/models_finds.py
+++ b/archaeological_finds/models_finds.py
@@ -295,7 +295,7 @@ class Find(BaseHistorizedItem, ImageModel, OwnPerms, ShortMenuItem):
'base_finds__context_record__parcel__town',
'base_finds__context_record__operation__year',
'base_finds__context_record__operation__operation_code',
- 'container__reference', 'container__location',
+ 'container__cached_label',
'base_finds__batch',
'base_finds__context_record__parcel__town',
'base_finds__context_record__parcel', ]
@@ -307,11 +307,13 @@ class Find(BaseHistorizedItem, ImageModel, OwnPerms, ShortMenuItem):
'base_finds__cache_complete_id',
'previous_id', 'label', 'material_types',
'datings__period__label', 'find_number', 'object_types',
+ 'container__cached_label',
'description',
'base_finds__context_record__parcel__town',
'base_finds__context_record__parcel', ]
- TABLE_COLS_FOR_OPE_LBL = {
+ COL_LABELS = {
'datings__period__label': _(u"Periods"),
+ 'container__cached_label': _(u"Container"),
}
EXTRA_FULL_FIELDS = [
@@ -369,6 +371,18 @@ class Find(BaseHistorizedItem, ImageModel, OwnPerms, ShortMenuItem):
'basket': 'basket',
'cached_label': 'cached_label__icontains',
'image': 'image__isnull'}
+ EXTRA_REQUEST_KEYS.update(
+ dict(
+ [(key, key) for key in TABLE_COLS
+ if key not in EXTRA_REQUEST_KEYS]
+ )
+ )
+ EXTRA_REQUEST_KEYS.update(
+ dict(
+ [(key, key) for key in TABLE_COLS_FOR_OPE
+ if key not in EXTRA_REQUEST_KEYS]
+ )
+ )
# fields
base_finds = models.ManyToManyField(BaseFind, verbose_name=_(u"Base find"),
@@ -486,10 +500,9 @@ class Find(BaseHistorizedItem, ImageModel, OwnPerms, ShortMenuItem):
@property
def full_label(self):
- lbl = u" - ".join([
- getattr(self, attr)
- for attr in ('label', 'administrative_index')
- if getattr(self, attr)])
+ lbl = u" - ".join([getattr(self, attr)
+ for attr in ('label', 'administrative_index')
+ if getattr(self, attr)])
base = u" - ".join([base_find.complete_id()
for base_find in self.base_finds.all()])
if base:
@@ -641,9 +654,9 @@ class Find(BaseHistorizedItem, ImageModel, OwnPerms, ShortMenuItem):
def get_query_owns(cls, user):
return Q(base_finds__context_record__operation__scientist=user.
ishtaruser.person) | \
- Q(base_finds__context_record__operation__in_charge=user.
- ishtaruser.person) | \
- Q(history_creator=user)
+ Q(base_finds__context_record__operation__in_charge=user.
+ ishtaruser.person) | \
+ Q(history_creator=user)
@classmethod
def get_owns(cls, user, menu_filtr=None, limit=None):
@@ -737,9 +750,10 @@ m2m_changed.connect(base_find_find_changed, sender=Find.base_finds.through)
class FindSource(Source):
SHOW_URL = 'show-findsource'
MODIFY_URL = 'find_source_modify'
- TABLE_COLS = ['find__base_finds__context_record__operation',
- 'find__base_finds__context_record', 'find'] + \
- Source.TABLE_COLS
+ TABLE_COLS = [
+ 'find__base_finds__context_record__operation',
+ 'find__base_finds__context_record', 'find'] + \
+ Source.TABLE_COLS
# search parameters
BOOL_FIELDS = ['duplicate']