From 8bf6c36bcbcaf6005b1a6358cbdb6d61288a6110 Mon Sep 17 00:00:00 2001 From: smile Date: Tue, 12 Nov 2013 21:28:00 +0100 Subject: [PATCH 1/2] added real names to admin user list combo --- account/cbase_members.py | 6 ++---- account/forms.py | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/account/cbase_members.py b/account/cbase_members.py index 23e5489..e6426cb 100644 --- a/account/cbase_members.py +++ b/account/cbase_members.py @@ -173,13 +173,11 @@ class MemberValues(object): if (result_data == []): break else: - ## here you don't have to append to a list - ## you could do whatever you want with the individual entry - ## The appending to list is just for illustration. if result_type == ldap.RES_SEARCH_ENTRY: result_set.append(result_data) - userlist = [x[0][1]['uid'][0] for x in result_set] + # list comprehension to get a list of user tupels in the format ("nickname", "nickname (real name)") + userlist = [(x[0][1]['uid'][0], '%s (%s)' % (x[0][1]['uid'][0], x[0][1]['cn'][0])) for x in result_set] return sorted(userlist) except: return [] \ No newline at end of file diff --git a/account/forms.py b/account/forms.py index 4860106..9659d5b 100644 --- a/account/forms.py +++ b/account/forms.py @@ -136,7 +136,7 @@ class AdminForm(forms.Form): def __init__(self, *args, **kwargs): self._request = kwargs.pop('request', None) self._users = kwargs.pop('users', []) - choices = [(x, x) for x in self._users] + choices = [x for x in self._users] choices.insert(0, ('', 'Select username ...')) super(AdminForm, self).__init__(*args, **kwargs) self.fields.insert(0, 'username', forms.ChoiceField(choices=choices, From a7d11a9f9dfc5da06741a9679ce177046f912219 Mon Sep 17 00:00:00 2001 From: smile Date: Tue, 12 Nov 2013 21:28:11 +0100 Subject: [PATCH 2/2] fixed typo --- account/templates/home.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/account/templates/home.html b/account/templates/home.html index 4ca70f8..77de400 100644 --- a/account/templates/home.html +++ b/account/templates/home.html @@ -47,7 +47,7 @@ {% blocktrans %}The external e-mail address is used by the board of c-base to reach you in cases where your c-base address (see above) is not working. To change your - externe e-mail address please contact the c-base board + external e-mail address please contact the c-base board (vorstand@c-base.org).{% endblocktrans %}