diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2018-09-05 11:28:11 +0200 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2018-09-05 11:28:11 +0200 |
commit | 5433da1181d6194406c71775f14d77e3daa481d5 (patch) | |
tree | f97bdfa7e93933278c3ca367c71a09d6e05b01f3 | |
parent | 9554264a2acccf88ee89cb89f20eb7bce967a561 (diff) | |
download | Ishtar-5433da1181d6194406c71775f14d77e3daa481d5.tar.bz2 Ishtar-5433da1181d6194406c71775f14d77e3daa481d5.zip |
Fix display of organizations in person tables
-rw-r--r-- | ishtar_common/models.py | 15 | ||||
-rw-r--r-- | ishtar_common/views.py | 2 |
2 files changed, 11 insertions, 6 deletions
diff --git a/ishtar_common/models.py b/ishtar_common/models.py index 4f1168d39..1656b1e64 100644 --- a/ishtar_common/models.py +++ b/ishtar_common/models.py @@ -2695,9 +2695,9 @@ class Person(Address, Merge, OwnPerms, ValueGetter): ('Dr', _(u'Doctor')), ) TABLE_COLS = ('name', 'surname', 'raw_name', 'email', 'person_types_list', - 'attached_to__name', 'town') + 'attached_to', 'town') TABLE_COLS_ACCOUNT = ('name', 'surname', 'raw_name', 'email', - 'profiles_list', 'attached_to__name', 'town') + 'profiles_list', 'attached_to', 'town') SHOW_URL = 'show-person' MODIFY_URL = 'person_modify' BASE_SEARCH_VECTORS = ['name', 'surname', 'raw_name', 'town', @@ -2706,11 +2706,11 @@ class Person(Address, Merge, OwnPerms, ValueGetter): # search parameters REVERSED_BOOL_FIELDS = ['ishtaruser__isnull'] EXTRA_REQUEST_KEYS = { - 'attached_to__name': 'attached_to__name', 'ishtaruser__isnull': 'ishtaruser__isnull', + 'attached_to': 'attached_to', } COL_LABELS = { - 'attached_to__name': _(u"Organization") + 'attached_to': _(u"Organization") } # alternative names of fields for searches @@ -3092,7 +3092,7 @@ post_save.connect(post_save_userprofile, sender=UserProfile) class IshtarUser(FullSearch): TABLE_COLS = ('username', 'person__name', 'person__surname', 'person__email', 'person__person_types_list', - 'person__attached_to') + 'person__attached_to__name') BASE_SEARCH_VECTORS = [ 'user_ptr__username', 'person__name', 'person__surname', 'person__email', 'person__town', 'person__attached_to__name'] @@ -3102,6 +3102,11 @@ class IshtarUser(FullSearch): 'person__person_types_list': 'person__person_types__label' } + COL_LABELS = { + 'person__attached_to__name': _(u"Organization"), + 'username': _(u"Username") + } + # alternative names of fields for searches ALT_NAMES = { 'username': ( diff --git a/ishtar_common/views.py b/ishtar_common/views.py index 54af31cff..afc928147 100644 --- a/ishtar_common/views.py +++ b/ishtar_common/views.py @@ -596,7 +596,7 @@ def autocomplete_organization(request, orga_type=None): q = request.GET.get('term') query = Q() for q in q.split(' '): - extra = Q(name__icontains=q) + extra = Q(cached_label__icontains=q) query = query & extra if orga_type: try: |