From 8807d09ef4aae1398fe06b1bef76557d242e5bef Mon Sep 17 00:00:00 2001 From: yaniv14 Date: Sun, 17 Jul 2016 13:13:49 +0300 Subject: [PATCH] Add related groups to remove from community form in members area. Added list columns for members admin view. --- src/acl/locale/he/LC_MESSAGES/django.mo | Bin 4346 -> 4346 bytes src/acl/locale/he/LC_MESSAGES/django.po | 2 +- .../locale/he/LC_MESSAGES/django.mo | Bin 16816 -> 16816 bytes .../locale/he/LC_MESSAGES/django.po | 2 +- .../locale/he/LC_MESSAGES/djangojs.mo | Bin 499 -> 499 bytes .../locale/he/LC_MESSAGES/djangojs.po | 2 +- .../templatetags/community_tags.py | 14 ++-- src/issues/locale/he/LC_MESSAGES/django.mo | Bin 9910 -> 9910 bytes src/issues/locale/he/LC_MESSAGES/django.po | 2 +- src/issues/locale/he/LC_MESSAGES/djangojs.mo | Bin 541 -> 541 bytes src/issues/locale/he/LC_MESSAGES/djangojs.po | 2 +- src/meetings/locale/he/LC_MESSAGES/django.mo | Bin 3938 -> 3938 bytes src/meetings/locale/he/LC_MESSAGES/django.po | 2 +- src/ocd/locale/he/LC_MESSAGES/django.mo | Bin 6157 -> 6157 bytes src/ocd/locale/he/LC_MESSAGES/django.po | 2 +- src/users/admin.py | 16 ++++- src/users/locale/he/LC_MESSAGES/django.mo | Bin 8146 -> 8146 bytes src/users/locale/he/LC_MESSAGES/django.po | 68 +++++++++--------- src/users/models.py | 6 ++ .../templates/users/member_update_form.html | 33 +++++---- .../templates/users/membership_groups.html | 4 +- 21 files changed, 94 insertions(+), 61 deletions(-) diff --git a/src/acl/locale/he/LC_MESSAGES/django.mo b/src/acl/locale/he/LC_MESSAGES/django.mo index dfcb65dd9531183139dc5acedf6db75b7bc5c263..193619d98ace8b66f693f2109cf6f83540134f4e 100644 GIT binary patch delta 17 YcmeyR_)Bra2~HMcD?`K0XE^oP0Ygs)NB{r; delta 17 YcmeyR_)Bra2~HM6D`WG`XE^oP0Yh&FP5=M^ diff --git a/src/acl/locale/he/LC_MESSAGES/django.po b/src/acl/locale/he/LC_MESSAGES/django.po index b63e4540..e48cba4a 100644 --- a/src/acl/locale/he/LC_MESSAGES/django.po +++ b/src/acl/locale/he/LC_MESSAGES/django.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2016-07-17 11:37+0300\n" +"POT-Creation-Date: 2016-07-17 13:11+0300\n" "PO-Revision-Date: 2016-06-07 11:27+0300\n" "Last-Translator: \n" "Language-Team: \n" diff --git a/src/communities/locale/he/LC_MESSAGES/django.mo b/src/communities/locale/he/LC_MESSAGES/django.mo index 861f0ab52c8f3a3f61bf33eb0a84055528c5731c..71c59d55803f6540640562a72c15dfc6bc9d433f 100644 GIT binary patch delta 19 Zcmdnc%(wxF_NlNKTNxT|KBV$a1^`R62XO!Z delta 19 Zcmdnc%(wxF_NlNKS{a*fKBV$a1^`Rc2X_Df diff --git a/src/communities/locale/he/LC_MESSAGES/django.po b/src/communities/locale/he/LC_MESSAGES/django.po index 4d22c100..a6f523df 100644 --- a/src/communities/locale/he/LC_MESSAGES/django.po +++ b/src/communities/locale/he/LC_MESSAGES/django.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Open Community\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2016-07-17 11:37+0300\n" +"POT-Creation-Date: 2016-07-17 13:11+0300\n" "PO-Revision-Date: 2016-07-17 11:39+0300\n" "Last-Translator: Yaniv Mirel \n" "Language-Team: \n" diff --git a/src/communities/locale/he/LC_MESSAGES/djangojs.mo b/src/communities/locale/he/LC_MESSAGES/djangojs.mo index e4822164a366c26f9c6dccb9597aed479c069a01..62bfa4daf1d6c13f086d479bf71ee47311a97b0b 100644 GIT binary patch delta 15 Wcmey&{F!;eMiyf$L&J?*?HB\n" "Language-Team: LANGUAGE \n" diff --git a/src/communities/templatetags/community_tags.py b/src/communities/templatetags/community_tags.py index 0ecc1f6b..91772758 100644 --- a/src/communities/templatetags/community_tags.py +++ b/src/communities/templatetags/community_tags.py @@ -3,9 +3,9 @@ from django.utils.translation import ugettext_lazy as _ from users.models import Membership - register = template.Library() + @register.filter def display_upcoming_time(committee): """ display only date if hour information if not set (remains at default '00:00) @@ -40,13 +40,13 @@ def upcoming_status(committee): ver = _("Version") if committee.upcoming_meeting_published_at: publish_time = timezone.localtime( - committee.upcoming_meeting_published_at) + committee.upcoming_meeting_published_at) else: publish_time = '' meeting_version = u'{0} {1} - {2}'.format(ver, - committee.upcoming_meeting_version, - _date(publish_time, 'd F Y, H:i')) + committee.upcoming_meeting_version, + _date(publish_time, 'd F Y, H:i')) if committee.upcoming_meeting_is_published: if committee.straw_voting_enabled: if committee.straw_vote_ended: @@ -62,6 +62,12 @@ def upcoming_status(committee): return rows + @register.filter def remove_email(args): return args.split('[')[0] + + +@register.filter() +def get_user_community_groups(user, arg): + return user.get_related_groups(arg) diff --git a/src/issues/locale/he/LC_MESSAGES/django.mo b/src/issues/locale/he/LC_MESSAGES/django.mo index 147c8103dbd904b96b5365610635dcef8590ea8f..2840183b2588bb5dba0731d6e3c3338263499887 100644 GIT binary patch delta 17 ZcmdnyyUlmQEpZlOD?`K0_r!1T0RTfb2MGWG delta 17 ZcmdnyyUlmQEpZk@D`WG`_r!1T0RTf*2M+)M diff --git a/src/issues/locale/he/LC_MESSAGES/django.po b/src/issues/locale/he/LC_MESSAGES/django.po index 3d4d9a56..aacb879c 100644 --- a/src/issues/locale/he/LC_MESSAGES/django.po +++ b/src/issues/locale/he/LC_MESSAGES/django.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Open Community\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2016-07-17 11:37+0300\n" +"POT-Creation-Date: 2016-07-17 13:11+0300\n" "PO-Revision-Date: 2015-05-14 13:18+0200\n" "Last-Translator: Yaniv Mirel \n" "Language-Team: \n" diff --git a/src/issues/locale/he/LC_MESSAGES/djangojs.mo b/src/issues/locale/he/LC_MESSAGES/djangojs.mo index 5ef3da0407a59d53b70ec020489dcc648c52f8ae..7f3f761c2487399ac44f8d840b4813b9023544ca 100644 GIT binary patch delta 15 WcmbQsGM8n-MHXW#L&J?%Js1HiJ_SYq delta 15 WcmbQsGM8n-MHWLVWAlwyJs1HiSOrV~ diff --git a/src/issues/locale/he/LC_MESSAGES/djangojs.po b/src/issues/locale/he/LC_MESSAGES/djangojs.po index cfbe8d88..cc763cae 100644 --- a/src/issues/locale/he/LC_MESSAGES/djangojs.po +++ b/src/issues/locale/he/LC_MESSAGES/djangojs.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Open Community\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2016-07-17 11:37+0300\n" +"POT-Creation-Date: 2016-07-17 13:11+0300\n" "PO-Revision-Date: 2015-03-05 16:27+0200\n" "Last-Translator: Yaniv Mirel \n" "Language-Team: \n" diff --git a/src/meetings/locale/he/LC_MESSAGES/django.mo b/src/meetings/locale/he/LC_MESSAGES/django.mo index 2d8d449e3a050e588952f9ba5050e473831cf490..a54715613c96118db6268c88f3ceafd09ea71c44 100644 GIT binary patch delta 17 YcmaDP_egF-0w;^Hm7(G06wZIF06P-~5C8xG delta 17 YcmaDP_egF-0w;^1m9hEe6wZIF06Q}V761SM diff --git a/src/meetings/locale/he/LC_MESSAGES/django.po b/src/meetings/locale/he/LC_MESSAGES/django.po index 5085385d..ee0bc772 100644 --- a/src/meetings/locale/he/LC_MESSAGES/django.po +++ b/src/meetings/locale/he/LC_MESSAGES/django.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Open Community\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2016-07-17 11:37+0300\n" +"POT-Creation-Date: 2016-07-17 13:11+0300\n" "PO-Revision-Date: 2015-05-14 13:18+0200\n" "Last-Translator: Yaniv Mirel \n" "Language-Team: \n" diff --git a/src/ocd/locale/he/LC_MESSAGES/django.mo b/src/ocd/locale/he/LC_MESSAGES/django.mo index be67920cebea7d0652ab860cccaa55e540e0b018..7314d0f15c70eca7a02fef5712afdc5af78c535d 100644 GIT binary patch delta 17 YcmeA*=r!1&#>Zl8WoWori|;Wf051at2><{9 delta 17 YcmeA*=r!1&#>Zl4Wo*7#i|;Wf052m24*&oF diff --git a/src/ocd/locale/he/LC_MESSAGES/django.po b/src/ocd/locale/he/LC_MESSAGES/django.po index c5744110..84089416 100644 --- a/src/ocd/locale/he/LC_MESSAGES/django.po +++ b/src/ocd/locale/he/LC_MESSAGES/django.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Open Community\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2016-07-17 11:37+0300\n" +"POT-Creation-Date: 2016-07-17 13:11+0300\n" "PO-Revision-Date: 2015-06-17 21:56+0200\n" "Last-Translator: Yaniv Mirel \n" "Language-Team: \n" diff --git a/src/users/admin.py b/src/users/admin.py index 18d2c8a7..cfa05f97 100644 --- a/src/users/admin.py +++ b/src/users/admin.py @@ -64,12 +64,23 @@ class UserMembershipInline(admin.TabularInline): class MembershipAdmin(admin.ModelAdmin): list_display = ( 'community', - 'group_name', + 'display_group_name', + 'display_user_email', 'user', 'created_at', ) - list_filter = ('community', 'group_name',) + list_filter = ('community', 'group_name', 'user__email', 'user') + ordering = ['community', ] + + def display_user_email(self, obj): + return obj.user.email + + def display_group_name(self, obj): + return obj.group_name.title + + display_user_email.short_description = _('Email') + display_group_name.short_description = _('Group') class OCUserAdmin(UserAdmin): @@ -107,6 +118,7 @@ def get_groups(self, obj): for g in groups: l.append(u'{0}: {1}'.format(g.group.title, g.committee.name)) return " | ".join(l) + get_groups.short_description = _('Committee & Groups') diff --git a/src/users/locale/he/LC_MESSAGES/django.mo b/src/users/locale/he/LC_MESSAGES/django.mo index da7622d187491d7c7a5a9692bc3b13717152c193..864e6df1d9b4643efcf601c9fcb33857de2725eb 100644 GIT binary patch delta 17 Zcmca)f60EsJ3$s>D?`K0p9CN90sux02S@+_ delta 17 Zcmca)f60EsJ3$shD`WG`p9CN90suxW2TlM0 diff --git a/src/users/locale/he/LC_MESSAGES/django.po b/src/users/locale/he/LC_MESSAGES/django.po index 0abd2617..8f16e0d7 100644 --- a/src/users/locale/he/LC_MESSAGES/django.po +++ b/src/users/locale/he/LC_MESSAGES/django.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Open Community\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2016-07-17 11:37+0300\n" +"POT-Creation-Date: 2016-07-17 13:11+0300\n" "PO-Revision-Date: 2016-07-17 11:40+0300\n" "Last-Translator: Yaniv Mirel \n" "Language-Team: \n" @@ -31,7 +31,16 @@ msgstr "" "סיסמאות אינם נשמרות כטקסט, אז אין אפשרות לראות את הסיסמא של המשתמש, אבל ניתן " "לשנות סיסמא בעזרת הקישור הזה." -#: .\admin.py:110 +#: .\admin.py:82 .\models.py:288 .\templates\users\member_profile.html:24 +msgid "Email" +msgstr "דואל" + +#: .\admin.py:83 .\models.py:134 .\models.py:300 .\models.py:303 +#: .\templates\users\member_update_form.html:9 +msgid "Group" +msgstr "קבוצה" + +#: .\admin.py:122 msgid "Committee & Groups" msgstr "ועדות וקבוצות" @@ -102,100 +111,91 @@ msgstr "משתמש" msgid "users" msgstr "משתמשים" -#: .\models.py:125 .\models.py:272 +#: .\models.py:131 .\models.py:278 msgid "Community" msgstr "קהילה" -#: .\models.py:127 .\models.py:287 +#: .\models.py:133 .\models.py:293 msgid "User" msgstr "משתמש" -#: .\models.py:128 .\models.py:294 .\models.py:297 -#: .\templates\users\member_update_form.html:9 -msgid "Group" -msgstr "קבוצה" - -#: .\models.py:130 +#: .\models.py:136 msgid "Old group" msgstr "קבוצה ישנה" -#: .\models.py:132 .\models.py:275 +#: .\models.py:138 .\models.py:281 msgid "Created at" msgstr "נוצר בתאריך" -#: .\models.py:135 +#: .\models.py:141 msgid "Invited by" msgstr "הוזמן על ידי" -#: .\models.py:138 +#: .\models.py:144 msgid "In position since" msgstr "מכהן מתאריך" -#: .\models.py:143 +#: .\models.py:149 msgid "Community Member" msgstr "חבר קהילה" -#: .\models.py:144 +#: .\models.py:150 msgid "Community Members" msgstr "חברי קהילה" -#: .\models.py:262 +#: .\models.py:268 msgid "Pending" msgstr "ממתין למשלוח" -#: .\models.py:263 +#: .\models.py:269 msgid "Sent" msgstr "נשלח" -#: .\models.py:264 +#: .\models.py:270 msgid "Failed" msgstr "נכשל" -#: .\models.py:278 +#: .\models.py:284 msgid "Created by" msgstr "נוצר על ידי" -#: .\models.py:281 +#: .\models.py:287 msgid "Name" msgstr "שם" -#: .\models.py:282 .\templates\users\member_profile.html:24 -msgid "Email" -msgstr "דואל" - -#: .\models.py:283 +#: .\models.py:289 msgid "Message" msgstr "הודעה" -#: .\models.py:290 +#: .\models.py:296 msgid "Groups" msgstr "קבוצות" -#: .\models.py:300 +#: .\models.py:306 msgid "Status" msgstr "סטאטוס" -#: .\models.py:302 +#: .\models.py:308 msgid "Times Sent" msgstr "מספר הפעמים שההזמנה נשלחה" -#: .\models.py:303 +#: .\models.py:309 msgid "Error count" msgstr "מספר הפעימים שהמשלוח נכשל" -#: .\models.py:304 +#: .\models.py:310 msgid "Sent at" msgstr "נשלח לאחרונה ב" -#: .\models.py:309 +#: .\models.py:315 msgid "Invitation" msgstr "הזמנה" -#: .\models.py:310 +#: .\models.py:316 msgid "Invitations" msgstr "הזמנות" -#: .\models.py:312 +#: .\models.py:318 #, python-format msgid "" "The system will allow you to take part in the decision making process of %s. " @@ -207,7 +207,7 @@ msgstr "" "אחרי אישור ההצטרפות ניתן לראות את הנושאים לדיון, את סדר היום לישיבה הקרובה, " "ואת סיכום ההחלטות מהישיבות הקודמות, ובעתיד ניתן יהיה גם לדון ולהשפיע עליהם." -#: .\models.py:327 +#: .\models.py:333 #, python-format msgid "Invitation to %s" msgstr "הזמנה לקהילה %s" diff --git a/src/users/models.py b/src/users/models.py index 938266d8..fd43d62d 100644 --- a/src/users/models.py +++ b/src/users/models.py @@ -103,6 +103,12 @@ def get_default_group(self, community): except Membership.DoesNotExist: return "" + def get_related_groups(self, community): + try: + return [x.group_name_id for x in self.memberships.filter(community=community)] + except Membership.DoesNotExist: + return None + def email_user(self, subject, message, from_email=None): """ Sends an email to this User. diff --git a/src/users/templates/users/member_update_form.html b/src/users/templates/users/member_update_form.html index eb420c59..ceef4f27 100644 --- a/src/users/templates/users/member_update_form.html +++ b/src/users/templates/users/member_update_form.html @@ -11,20 +11,29 @@ {% block content %} {% csrf_token %} - {{form}} + {{ form }} {% endblock %} {% block scripts %} - + {% endblock %} diff --git a/src/users/templates/users/membership_groups.html b/src/users/templates/users/membership_groups.html index 68974c67..ee659d28 100644 --- a/src/users/templates/users/membership_groups.html +++ b/src/users/templates/users/membership_groups.html @@ -1,5 +1,5 @@ {% extends "base.html" %} -{% load i18n %} +{% load i18n community_tags %} {% block title %} @@ -41,7 +41,7 @@ <h2>   {{ member.user.display_name.0 }}</h2> <div class="checkbox form-control members-list-abc"> <label> - <input type="checkbox" name="members" value="{{ member.user.id }}"> {{ member.user.display_name }} + <input type="checkbox" name="members" value="{{ member.user.id }}" data-groups="{{ member.user|get_user_community_groups:community }}"> {{ member.user.display_name }} </label> </div> </div>