diff options
Diffstat (limited to 'ishtar_common/models_common.py')
| -rw-r--r-- | ishtar_common/models_common.py | 25 | 
1 files changed, 25 insertions, 0 deletions
| diff --git a/ishtar_common/models_common.py b/ishtar_common/models_common.py index 1c77d1a90..779af635b 100644 --- a/ishtar_common/models_common.py +++ b/ishtar_common/models_common.py @@ -2687,6 +2687,31 @@ class GeographicItem(models.Model):      geodata = models.ManyToManyField(          GeoVectorData, blank=True, related_name="related_items_%(app_label)s_%(class)s"      ) +    ALT_NAMES = { +        "geodata__name": SearchAltName( +            pgettext_lazy("key for text search", "geo-name"), "geodata__name__iexact" +        ), +        "geodata__data_type": SearchAltName( +            pgettext_lazy("key for text search", "geo-type"), "geodata__data_type__label__iexact" +        ), +        "geodata__origin": SearchAltName( +            pgettext_lazy("key for text search", "geo-origin"), "geodata__origin__label__iexact" +        ), +        "geodata__provider": SearchAltName( +            pgettext_lazy("key for text search", "geo-provider"), "geodata__provider__label__iexact" +        ), +        "geodata__comment": SearchAltName( +            pgettext_lazy("key for text search", "geo-comment"), "geodata__comment__iexact" +        ), +    } + +    @classmethod +    def ALT_NAMES_FOR_FIND(cls): +        dct = {} +        for k in cls.ALT_NAMES: +            sa = cls.ALT_NAMES[k] +            dct[k] = SearchAltName(sa.search_key, "base_finds__" + sa.search_query) +        return dct      class Meta:          abstract = True | 
