diff options
-rw-r--r-- | CHANGES.md | 7 | ||||
-rw-r--r-- | ishtar_common/forms_common.py | 5 | ||||
-rw-r--r-- | ishtar_common/models.py | 11 |
3 files changed, 20 insertions, 3 deletions
diff --git a/CHANGES.md b/CHANGES.md index a9a1f52b1..510e51cdb 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -6,6 +6,13 @@ date: 2022-09-18 Ishtar changelog ================ +v3.2.6 - 2022-09- +-------------------- + +### Features ### + +- organization: add columns to table - add town search criteria + v3.2.5 - 2022-09-18 -------------------- diff --git a/ishtar_common/forms_common.py b/ishtar_common/forms_common.py index 7f8394768..6f0d01427 100644 --- a/ishtar_common/forms_common.py +++ b/ishtar_common/forms_common.py @@ -112,7 +112,9 @@ def get_advanced_town_field(label=_("Town"), required=True): ) -def get_person_field(label=_("Person"), required=True, person_types=[]): +def get_person_field(label=_("Person"), required=True, person_types=None): + if not person_types: + person_types = [] # !FIXME hard_link, reverse_lazy doen't seem to work with formsets widget = None url = "/" + settings.URL_PATH + "autocomplete-person" @@ -467,6 +469,7 @@ class OrganizationSelect(CustomForm, TableSelect): ) name = forms.CharField(label=_("Name"), max_length=300) organization_type = forms.ChoiceField(label=_("Type"), choices=[]) + precise_town = get_town_field() def __init__(self, *args, **kwargs): super(OrganizationSelect, self).__init__(*args, **kwargs) diff --git a/ishtar_common/models.py b/ishtar_common/models.py index a133afead..470ea4e72 100644 --- a/ishtar_common/models.py +++ b/ishtar_common/models.py @@ -2315,16 +2315,19 @@ organization_type_pks_lazy = lazy(OrganizationType.get_or_create_pks, str) class Organization(Address, Merge, OwnPerms, BaseGenderedType, ValueGetter, MainItem): - TABLE_COLS = ("name", "organization_type", "town") + TABLE_COLS = ("name", "organization_type", "address", "town", "precise_town") SLUG = "organization" SHOW_URL = "show-organization" DELETE_URL = "delete-organization" # search parameters - EXTRA_REQUEST_KEYS = {} + EXTRA_REQUEST_KEYS = { + "precise_town": "precise_town__cached_label" + } BASE_SEARCH_VECTORS = [ SearchVectorConfig("name"), SearchVectorConfig("town"), + SearchVectorConfig("precise_town__name"), ] # alternative names of fields for searches @@ -2336,6 +2339,10 @@ class Organization(Address, Merge, OwnPerms, BaseGenderedType, ValueGetter, Main pgettext_lazy("key for text search", "type"), "organization_type__label__iexact", ), + "precise_town": SearchAltName( + pgettext_lazy("key for text search", "town"), + "precise_town__cached_label__iexact", + ), } QA_EDIT = QuickAction( url="organization-qa-bulk-update", |