diff options
Diffstat (limited to 'archaeological_operations/models.py')
| -rw-r--r-- | archaeological_operations/models.py | 63 | 
1 files changed, 63 insertions, 0 deletions
diff --git a/archaeological_operations/models.py b/archaeological_operations/models.py index f09184a32..8fa00a215 100644 --- a/archaeological_operations/models.py +++ b/archaeological_operations/models.py @@ -116,6 +116,69 @@ class ArchaeologicalSite(BaseHistorizedItem):      M2M_SEARCH_VECTORS = ["periods__label", "remains__label", "towns__name"]      PARENT_SEARCH_VECTORS = ['operations'] +    DATED_FIELDS = ['sinking_date'] + +    EXTRA_REQUEST_KEYS = {} + +    # alternative names of fields for searches +    ALT_NAMES = { +        'reference': ( +            pgettext_lazy(TXT_SEARCH_COMMENT, u"reference"), +            'reference' +        ), +        'name': ( +            pgettext_lazy(TXT_SEARCH_COMMENT, u"name"), +            'name' +        ), +        'periods': ( +            pgettext_lazy(TXT_SEARCH_COMMENT, u"period"), +            'periods__label__iexact' +        ), +        'remains': ( +            pgettext_lazy(TXT_SEARCH_COMMENT, u"remain"), +            'remains__label__iexact' +        ), +        'towns': ( +            pgettext_lazy(TXT_SEARCH_COMMENT, u"town"), +            'towns__cached_label__iexact' +        ), +        'comment': ( +            pgettext_lazy(TXT_SEARCH_COMMENT, u"comment"), +            'comment__icontains' +        ), +        'locality_ngi': ( +            pgettext_lazy(TXT_SEARCH_COMMENT, u"locality-ngi"), +            'locality_ngi__icontains' +        ), +        'locality_cadastral': ( +            pgettext_lazy(TXT_SEARCH_COMMENT, u"locality-cadastral"), +            'locality_cadastral__icontains' +        ), +        'shipwreck_name': ( +            pgettext_lazy(TXT_SEARCH_COMMENT, u"shipwreck-name"), +            'shipwreck_name__iexact' +        ), +        'oceanographic_service_localisation': ( +            pgettext_lazy(TXT_SEARCH_COMMENT, +                          u"oceanographic-service-localisation"), +            'oceanographic_service_localisation__icontains' +        ), +        'shipwreck_code': ( +            pgettext_lazy(TXT_SEARCH_COMMENT, u"shipwreck-code"), +            'shipwreck_code__iexact' +        ), +        'sinking_date': ( +            pgettext_lazy(TXT_SEARCH_COMMENT, u"sinking-date"), +            'sinking_date' +        ), +        'discovery_area': ( +            pgettext_lazy(TXT_SEARCH_COMMENT, u"discovery-area"), +            'discovery_area__icontains' +        ), +    } +    for v in ALT_NAMES.values(): +        EXTRA_REQUEST_KEYS[v[0]] = v[1] +      reference = models.CharField(_(u"Reference"), max_length=200, unique=True)      name = models.CharField(_(u"Name"), max_length=200,                              null=True, blank=True)  | 
