diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2023-03-01 17:31:44 +0100 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2023-03-01 17:31:44 +0100 |
commit | cbff90a09baa33a267966377338414b3cba870e8 (patch) | |
tree | 4f67022d715676eedd3457a47749ab154569a745 | |
parent | 2ecf1dd3333c8f130ecbad8787c5fc6503ae4f14 (diff) | |
download | Ishtar-cbff90a09baa33a267966377338414b3cba870e8.tar.bz2 Ishtar-cbff90a09baa33a267966377338414b3cba870e8.zip |
Search - Account: add "profile type" field
-rw-r--r-- | CHANGES.md | 1 | ||||
-rw-r--r-- | ishtar_common/forms_common.py | 13 | ||||
-rw-r--r-- | ishtar_common/models.py | 4 |
3 files changed, 13 insertions, 5 deletions
diff --git a/CHANGES.md b/CHANGES.md index 3083fc4c9..19a06b447 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -22,6 +22,7 @@ Ishtar changelog - add created before/after field - Operation: add "old code" field - Find: add "remain" field (operations and sites) + - Account: add "profile type" field - Free text search: - use accent and unaccented string - add french_archeo thesaurus config diff --git a/ishtar_common/forms_common.py b/ishtar_common/forms_common.py index f14799f53..4286ae9fd 100644 --- a/ishtar_common/forms_common.py +++ b/ishtar_common/forms_common.py @@ -783,11 +783,10 @@ class PersonSelect(CustomForm, TableSelect): ), validators=[models.valid_id(models.Organization)], ) - - def __init__(self, *args, **kwargs): - super(PersonSelect, self).__init__(*args, **kwargs) - self.fields["person_types"].choices = models.PersonType.get_types() - self.fields["title"].choices = models.TitleType.get_types() + TYPES = [ + FieldType("person_types", models.PersonType), + FieldType("title", models.TitleType), + ] class PersonFormSelection(CustomFormSearch): @@ -963,6 +962,10 @@ class SimplePersonForm(ManageOldType, NewItemForm): class PersonUserSelect(PersonSelect): ishtaruser__isnull = forms.NullBooleanField(label=_("Already has an account")) + profiles__profile_type = forms.ChoiceField(label=_("Profile type"), choices=[]) + TYPES = [ + FieldType("profiles__profile_type", models.ProfileType), + ] class PersonUserFormSelection(PersonFormSelection): diff --git a/ishtar_common/models.py b/ishtar_common/models.py index 096a5e0a7..80a6a9141 100644 --- a/ishtar_common/models.py +++ b/ishtar_common/models.py @@ -2808,6 +2808,10 @@ class Person(Address, Merge, OwnPerms, ValueGetter, MainItem): pgettext_lazy("key for text search", "has-account"), "ishtaruser__isnull", ), + "profiles__profile_type": SearchAltName( + pgettext_lazy("key for text search", "profile-type"), + "profiles__profile_type__label__iexact", + ), } QA_EDIT = QuickAction( url="person-qa-bulk-update", |