diff options
Diffstat (limited to 'archaeological_context_records/models.py')
-rw-r--r-- | archaeological_context_records/models.py | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/archaeological_context_records/models.py b/archaeological_context_records/models.py index e1cb216a2..625356990 100644 --- a/archaeological_context_records/models.py +++ b/archaeological_context_records/models.py @@ -135,6 +135,27 @@ class ContextRecord(BaseHistorizedItem, ImageModel, OwnPerms, ShortMenuItem): } } IMAGE_PREFIX = 'context_records/' + + # search parameters + CONTEXTRECORD_EXTRA_KEYS = { + 'parcel__town': 'parcel__town__pk', + 'operation__year': 'operation__year__contains', + 'operation__code_patriarche': 'operation__code_patriarche', + 'operation__operation_code': 'operation__operation_code', + 'datings__period': 'datings__period__pk', + 'parcel_0': 'operation__parcels__section', + 'parcel_1': 'operation__parcels__parcel_number', + 'parcel_2': 'operation__parcels__public_domain', + 'label': 'label__icontains', + 'archaeological_sites': 'operation__archaeological_sites__pk', + 'cached_label': 'cached_label__icontains', + } + RELATION_TYPES_PREFIX = {'ope_relation_types': 'operation__'} + RELATIVE_SESSION_NAMES = [ + ('operation', 'operation__pk'), + ('file', 'operation__associated_file__pk')] + + # fields external_id = models.TextField(_(u"External ID"), blank=True, null=True) auto_external_id = models.BooleanField( _(u"External ID is set automatically"), default=False) @@ -383,6 +404,11 @@ class RecordRelations(GeneralRecordRelations, models.Model): "right_record__datings__period": _(u"Periods (right)") } + # search parameters + EXTRA_REQUEST_KEYS = { + "left_record__operation": "left_record__operation__pk" + } + class Meta: verbose_name = _(u"Record relation") verbose_name_plural = _(u"Record relations") @@ -396,6 +422,30 @@ class ContextRecordSource(Source): TABLE_COLS = ['context_record__operation', 'context_record'] + \ Source.TABLE_COLS + # search parameters + RELATIVE_SESSION_NAMES = [ + ('contextrecord', 'context_record__pk'), + ('operation', 'context_record__operation__pk'), + ('file', 'context_record__operation__associated_file__pk')] + BOOL_FIELDS = ['duplicate'] + EXTRA_REQUEST_KEYS = { + 'title': 'title__icontains', + 'description': 'description__icontains', + 'comment': 'comment__icontains', + 'person': 'authors__person__pk', + 'additional_information': 'additional_information__icontains', + 'context_record__parcel__town': 'context_record__parcel__town__pk', + 'context_record__operation__year': 'context_record__operation__year', + 'context_record__operation__operation_code': + 'context_record__operation__operation_code', + 'context_record__operation__code_patriarche': + 'context_record__operation__code_patriarche', + 'context_record__operation': 'context_record__operation__pk', + 'context_record__datings__period': + 'context_record__datings__period__pk', + 'context_record__unit': 'context_record__unit__pk', + } + class Meta: verbose_name = _(u"Context record documentation") verbose_name_plural = _(u"Context record documentations") |