From d0771063b32c1778f3128a517f0925fec7f70791 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Norman=20J=C3=A4ckel?= Date: Thu, 25 Oct 2012 21:08:29 +0200 Subject: [PATCH 01/13] Fix assignment overview table, ticket #372 --- openslides/assignment/templates/assignment/overview.html | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/openslides/assignment/templates/assignment/overview.html b/openslides/assignment/templates/assignment/overview.html index 2d9e3b8e0..717ff1538 100644 --- a/openslides/assignment/templates/assignment/overview.html +++ b/openslides/assignment/templates/assignment/overview.html @@ -31,7 +31,12 @@ {{ assignment }} - {{ assignment.candidates|length }} / {{ assignment.posts }} + + {{ assignment.posts }} {% trans "posts" %} / {{ assignment.elected|length }} {% trans "elected" %} + {% if assignment.status != 'fin' %} + / {{ assignment.candidates|length }} {% trans "candidates" %} + {% endif %} + {{ assignment.get_status_display }} From 4052e137a2809c82a31b80337df46462b7e1ca84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Norman=20J=C3=A4ckel?= Date: Thu, 25 Oct 2012 21:28:13 +0200 Subject: [PATCH 02/13] Insert new list with all elected candidates, see ticket #374 --- .../assignment/templates/assignment/view.html | 24 ++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/openslides/assignment/templates/assignment/view.html b/openslides/assignment/templates/assignment/view.html index 7616f6a63..2f46fa81f 100644 --- a/openslides/assignment/templates/assignment/view.html +++ b/openslides/assignment/templates/assignment/view.html @@ -88,18 +88,36 @@ {% endif %} {% endif %} + +

{% trans "Elected Candidates" %}

+
    + {% for person in assignment.elected %} +
  • + {{ person }} + {% if perms.assignment.can_manage_assignment %} + {% if assignment.status == "sea" or assignment.status == "vot" %} + + {% endif %} + {% endif %} +
  • + {% empty %} +
  • {% trans "There are no elected candidates available." %}
  • + {% endfor %} +
+ {% if perms.assignment.can_manage_assignments %}

{% trans "Blocked Candidates" %}

    - {% for candidate in blocked_candidates %} + {% for person in blocked_candidates %}
  • - {{ candidate }} + {{ person }}
  • {% empty %} -
  • {% trans "There are no blocked candidates." %}
  • +
  • {% trans "There are no blocked candidates available." %}
  • {% endfor %}
{% endif %} +

{% trans "Election results" %}

{% if polls.exists %} From 1849e14dbffebdee5a3b82270fbb68868d9af1cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Norman=20J=C3=A4ckel?= Date: Thu, 25 Oct 2012 21:47:59 +0200 Subject: [PATCH 03/13] Insert widget with static welcome text (see frontpage and config tab), ticket #387 --- .../templates/projector/static_info_widget.html | 1 + openslides/projector/views.py | 9 +++++++++ 2 files changed, 10 insertions(+) create mode 100644 openslides/projector/templates/projector/static_info_widget.html diff --git a/openslides/projector/templates/projector/static_info_widget.html b/openslides/projector/templates/projector/static_info_widget.html new file mode 100644 index 000000000..b99a5cbd9 --- /dev/null +++ b/openslides/projector/templates/projector/static_info_widget.html @@ -0,0 +1 @@ +{{ welcometext|safe|linebreaks }} diff --git a/openslides/projector/views.py b/openslides/projector/views.py index 54fa7a866..983b1d4d8 100644 --- a/openslides/projector/views.py +++ b/openslides/projector/views.py @@ -382,6 +382,15 @@ def get_widgets(request): """ widgets = [] + # Static Info widget + widgets.append(Widget( + name='static_info', + display_name=config['frontpage_title'], + template='projector/static_info_widget.html', + context={'welcometext': config['frontpage_welcometext'],}, + permission_required=None, + default_column=1)) + # Projector live view widget widgets.append(Widget( name='live_view', From d6ebbdc54120b6eb61e4f7a02e9242011d97132d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Norman=20J=C3=A4ckel?= Date: Thu, 25 Oct 2012 21:57:02 +0200 Subject: [PATCH 04/13] Fix plural-error on ballot paper, ticket #393 --- openslides/assignment/views.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/openslides/assignment/views.py b/openslides/assignment/views.py index 0c1e1f969..1db7fa849 100644 --- a/openslides/assignment/views.py +++ b/openslides/assignment/views.py @@ -542,7 +542,8 @@ class AssignmentPollPDF(PDFView): ballot_string = _("%d. ballot") % self.poll.get_ballot() candidate_string = ungettext("%d candidate", "%d candidates", len(options)) % len(options) - available_posts_string = _("%d available posts") % self.poll.assignment.posts + available_posts_string = ungettext("%d available post", "%d available posts", + self.poll.assignment.posts) % self.poll.assignment.posts cell.append(Paragraph("%s, %s, %s" % (ballot_string, candidate_string, available_posts_string), stylesheet['Ballot_description'])) cell.append(Spacer(0, 0.4 * cm)) From 0ec106a0340cf8c761fbca2bb0c091c6bd98a262 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Norman=20J=C3=A4ckel?= Date: Thu, 25 Oct 2012 22:18:20 +0200 Subject: [PATCH 05/13] Fix message on assignment slide, ticket #389 --- openslides/assignment/models.py | 1 + openslides/assignment/templates/projector/Assignment.html | 2 ++ 2 files changed, 3 insertions(+) diff --git a/openslides/assignment/models.py b/openslides/assignment/models.py index af67411a6..9d2cf8814 100644 --- a/openslides/assignment/models.py +++ b/openslides/assignment/models.py @@ -230,6 +230,7 @@ class Assignment(models.Model, SlideMixin): data = super(Assignment, self).slide() data['assignment'] = self data['title'] = self.name + data['polls_available'] = self.poll_set.exists() data['polls'] = self.poll_set.filter(published=True) data['vote_results'] = self.vote_results(only_published=True) data['assignment_publish_winner_results_only'] = \ diff --git a/openslides/assignment/templates/projector/Assignment.html b/openslides/assignment/templates/projector/Assignment.html index 8a5c50b0e..181597a9f 100644 --- a/openslides/assignment/templates/projector/Assignment.html +++ b/openslides/assignment/templates/projector/Assignment.html @@ -122,6 +122,8 @@ + {% elif polls_available %} + {% trans "Vote results are not published yet." %} {% elif assignment.candidates %} {% trans "No ballots available." %} {% endif %} From 510aca54eb9af7b011572c6ab7754d5dca917de9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Norman=20J=C3=A4ckel?= Date: Thu, 25 Oct 2012 23:58:32 +0200 Subject: [PATCH 06/13] Add widget with personal info, ticket #25 --- .../participant/personal_info_widget.html | 49 +++++++++++++++++ openslides/participant/views.py | 52 +++++++++++++++++++ 2 files changed, 101 insertions(+) create mode 100644 openslides/participant/templates/participant/personal_info_widget.html diff --git a/openslides/participant/templates/participant/personal_info_widget.html b/openslides/participant/templates/participant/personal_info_widget.html new file mode 100644 index 000000000..5b300a599 --- /dev/null +++ b/openslides/participant/templates/participant/personal_info_widget.html @@ -0,0 +1,49 @@ +{% load i18n %} +{% load tags %} + +
    + {% trans "You submitted the following motions:" %} + {% for motion in submitted_motions %} +
  • + {{ motion.public_version.title }} + ({% trans "motion" %} + {% if motion.number %} + {{ motion.number }}) + {% else %} + [{% trans "no number" %}]) + {% endif %} +
  • + {% empty %} +
  • {% trans "Currently none" %}
  • + {% endfor %} +
+ +{% if config_motion_min_supporters %} +
+
    + {% trans "You support the following motions:" %} + {% for motion in supported_motions %} +
  • + {{ motion.public_version.title }} + ({% trans "motion" %} + {% if motion.number %} + {{ motion.number }}) + {% else %} + [{% trans "no number" %}]) + {% endif %} +
  • + {% empty %} +
  • {% trans "Currently none" %}
  • + {% endfor %} +
+{% endif %} + +
+
    + {% trans "You are candidate in the following assignments:" %} + {% for assignment in assignments %} +
  • {{ assignment }}
  • + {% empty %} +
  • {% trans "Currently none" %}
  • + {% endfor %} +
diff --git a/openslides/participant/views.py b/openslides/participant/views.py index 8c49d6eee..01d97cfa1 100644 --- a/openslides/participant/views.py +++ b/openslides/participant/views.py @@ -44,6 +44,11 @@ from openslides.utils.views import ( from openslides.config.models import config +from openslides.projector.projector import Widget + +from openslides.motion.models import Motion +from openslides.assignment.models import Assignment + from openslides.participant.api import gen_username, gen_password, import_users from openslides.participant.forms import ( UserCreateForm, UserUpdateForm, UsersettingsForm, @@ -503,3 +508,50 @@ def register_tab(request): permission=request.user.has_perm('participant.can_see_participant') or request.user.has_perm('participant.can_manage_participant'), selected=selected) + + +def get_widgets(request): + """ + Returns all widgets of the participant app. This is a user_widget, a + group_widget and a personal_info_widget. + """ + return [ + get_personal_info_widget(request), + #get_user_widget(request), + #get_group_widget(request) + ] + + +def get_personal_info_widget(request): + """ + Provides a widget for personal info. It shows your submitted motions + and where you are supporter or candidate. + """ + personal_info_context = { + 'submitted_motions': Motion.objects.filter(submitter=request.user), + 'config_motion_min_supporters': config['motion_min_supporters'], + 'supported_motions': Motion.objects.filter(motionsupporter=request.user), + 'assignments': [ assignment for assignment in Assignment.objects.all() if assignment.is_candidate(request.user) ],} + return Widget( + name='personal_info', + display_name=_('On You'), + template='participant/personal_info_widget.html', + context=personal_info_context, + permission_required=None, + default_column=1) + + +def get_user_widget(request): + """ + Provides a widget with all users. This is for short activation of + user slides. + """ + pass + + +def get_group_widget(request): + """ + Provides a widget with all groups. This is for short activation of + group slides. + """ + pass From 1063e7011a4c4a261e0c1f76733447f8bc7ec3d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Norman=20J=C3=A4ckel?= Date: Fri, 26 Oct 2012 17:14:46 +0200 Subject: [PATCH 07/13] Change query for assignments in personal_info_widget --- openslides/participant/views.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/openslides/participant/views.py b/openslides/participant/views.py index 01d97cfa1..1dd58185e 100644 --- a/openslides/participant/views.py +++ b/openslides/participant/views.py @@ -531,7 +531,9 @@ def get_personal_info_widget(request): 'submitted_motions': Motion.objects.filter(submitter=request.user), 'config_motion_min_supporters': config['motion_min_supporters'], 'supported_motions': Motion.objects.filter(motionsupporter=request.user), - 'assignments': [ assignment for assignment in Assignment.objects.all() if assignment.is_candidate(request.user) ],} + 'assignments': Assignment.objects.filter( + assignmentcandidate__person=request.user, + assignmentcandidate__blocked=False),} return Widget( name='personal_info', display_name=_('On You'), From 3f0c31d12b953282cd46b30a7256b046f0097635 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Norman=20J=C3=A4ckel?= Date: Fri, 26 Oct 2012 18:16:09 +0200 Subject: [PATCH 08/13] Add user widget and group widget, see # 379 --- .../templates/participant/group_widget.html | 26 +++++++++++++++++++ .../templates/participant/user_widget.html | 24 +++++++++++++++++ openslides/participant/views.py | 21 +++++++++++---- 3 files changed, 66 insertions(+), 5 deletions(-) create mode 100644 openslides/participant/templates/participant/group_widget.html create mode 100644 openslides/participant/templates/participant/user_widget.html diff --git a/openslides/participant/templates/participant/group_widget.html b/openslides/participant/templates/participant/group_widget.html new file mode 100644 index 000000000..5900ef547 --- /dev/null +++ b/openslides/participant/templates/participant/group_widget.html @@ -0,0 +1,26 @@ +{% load i18n %} +{% load tags %} + +
    +{% for group in groups %} + {% if group.name != 'Anonymous' %} +
  • + +
    +
    + + + + + + + + + + {{ group }} +
  • + {% endif %} +{% empty %} +
  • {% trans 'No groups available.' %}
  • +{% endfor %} +
diff --git a/openslides/participant/templates/participant/user_widget.html b/openslides/participant/templates/participant/user_widget.html new file mode 100644 index 000000000..21e0db5a9 --- /dev/null +++ b/openslides/participant/templates/participant/user_widget.html @@ -0,0 +1,24 @@ +{% load i18n %} +{% load tags %} + + diff --git a/openslides/participant/views.py b/openslides/participant/views.py index 1dd58185e..12fe213fc 100644 --- a/openslides/participant/views.py +++ b/openslides/participant/views.py @@ -517,9 +517,8 @@ def get_widgets(request): """ return [ get_personal_info_widget(request), - #get_user_widget(request), - #get_group_widget(request) - ] + get_user_widget(request), + get_group_widget(request)] def get_personal_info_widget(request): @@ -548,7 +547,13 @@ def get_user_widget(request): Provides a widget with all users. This is for short activation of user slides. """ - pass + return Widget( + name='user', + display_name=_('Users'), + template='participant/user_widget.html', + context={'users': User.objects.all(),}, + permission_required='projector.can_manage_projector', + default_column=1) def get_group_widget(request): @@ -556,4 +561,10 @@ def get_group_widget(request): Provides a widget with all groups. This is for short activation of group slides. """ - pass + return Widget( + name='group', + display_name=_('Groups'), + template='participant/group_widget.html', + context={'groups': Group.objects.all(),}, + permission_required='projector.can_manage_projector', + default_column=1) From 015dc159edcc7db96ffa7a9d30388e4508fdf8dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Norman=20J=C3=A4ckel?= Date: Sat, 27 Oct 2012 18:17:22 +0200 Subject: [PATCH 09/13] Add UserView and GroupView part 1 --- .../templates/participant/group_detail.html | 9 +++++ .../templates/participant/user_detail.html | 9 +++++ openslides/participant/urls.py | 40 +++++++++++++------ openslides/participant/views.py | 21 ++++++++-- 4 files changed, 63 insertions(+), 16 deletions(-) create mode 100644 openslides/participant/templates/participant/group_detail.html create mode 100644 openslides/participant/templates/participant/user_detail.html diff --git a/openslides/participant/templates/participant/group_detail.html b/openslides/participant/templates/participant/group_detail.html new file mode 100644 index 000000000..770380218 --- /dev/null +++ b/openslides/participant/templates/participant/group_detail.html @@ -0,0 +1,9 @@ +{% extends "participant/base_participant.html" %} + +{% block title %}{{ block.super }} – {{ object }}{% endblock %} + +{% block content %} + +{{ object }} + +{% endblock %} diff --git a/openslides/participant/templates/participant/user_detail.html b/openslides/participant/templates/participant/user_detail.html new file mode 100644 index 000000000..770380218 --- /dev/null +++ b/openslides/participant/templates/participant/user_detail.html @@ -0,0 +1,9 @@ +{% extends "participant/base_participant.html" %} + +{% block title %}{{ block.super }} – {{ object }}{% endblock %} + +{% block content %} + +{{ object }} + +{% endblock %} diff --git a/openslides/participant/urls.py b/openslides/participant/urls.py index f55c30756..ed98c45c5 100644 --- a/openslides/participant/urls.py +++ b/openslides/participant/urls.py @@ -14,14 +14,16 @@ from django.conf.urls.defaults import url, patterns from django.core.urlresolvers import reverse from openslides.participant.views import ( - ParticipantsListPDF, ParticipantsPasswordsPDF, Overview, UserCreateView, - UserUpdateView, UserDeleteView, SetUserStatusView, UserImportView, - ResetPasswordView, GroupOverviewView, GroupCreateView, GroupUpdateView, - GroupDeleteView) + UserOverview, UserCreateView, UserDetailView, UserUpdateView, + UserDeleteView, ResetPasswordView, SetUserStatusView, UserImportView, + GroupOverview, GroupCreateView, GroupDetailView, GroupUpdateView, GroupDeleteView, + ParticipantsListPDF, ParticipantsPasswordsPDF) -urlpatterns = patterns('openslides.participant.views', +urlpatterns = patterns('', + + # User url(r'^$', - Overview.as_view(), + UserOverview.as_view(), name='user_overview', ), @@ -30,6 +32,11 @@ urlpatterns = patterns('openslides.participant.views', name='user_new', ), + url(r'^(?P\d+)/$', + UserDetailView.as_view(), + name='user_detail', + ), + url(r'^(?P\d+)/edit/$', UserUpdateView.as_view(), name='user_edit', @@ -45,12 +52,6 @@ urlpatterns = patterns('openslides.participant.views', name='user_reset_password', ), - url(r'^(?P\d+)/status/toggle/$', - SetUserStatusView.as_view(), - {'action': 'toggle'}, - name='user_status_toggle', - ), - url(r'^(?P\d+)/status/activate/$', SetUserStatusView.as_view(), {'action': 'activate'}, @@ -63,13 +64,20 @@ urlpatterns = patterns('openslides.participant.views', name='user_status_deactivate', ), + url(r'^(?P\d+)/status/toggle/$', + SetUserStatusView.as_view(), + {'action': 'toggle'}, + name='user_status_toggle', + ), + url(r'^import/$', UserImportView.as_view(), name='user_import', ), + # Group url(r'^group/$', - GroupOverviewView.as_view(), + GroupOverview.as_view(), name='user_group_overview', ), @@ -78,6 +86,11 @@ urlpatterns = patterns('openslides.participant.views', name='user_group_new', ), + url(r'^group/(?P\d+)/$', + GroupDetailView.as_view(), + name='user_group_detail', + ), + url(r'^group/(?P\d+)/edit/$', GroupUpdateView.as_view(), name='user_group_edit', @@ -88,6 +101,7 @@ urlpatterns = patterns('openslides.participant.views', name='user_group_delete', ), + # PDF url(r'^print/$', ParticipantsListPDF.as_view(), name='user_print', diff --git a/openslides/participant/views.py b/openslides/participant/views.py index 12fe213fc..4fa817128 100644 --- a/openslides/participant/views.py +++ b/openslides/participant/views.py @@ -56,7 +56,7 @@ from openslides.participant.forms import ( from openslides.participant.models import User, Group -class Overview(ListView): +class UserOverview(ListView): """ Show all participants (users). """ @@ -112,7 +112,7 @@ class Overview(ListView): return query.all() def get_context_data(self, **kwargs): - context = super(Overview, self).get_context_data(**kwargs) + context = super(UserOverview, self).get_context_data(**kwargs) all_users = User.objects.count() @@ -140,6 +140,21 @@ class Overview(ListView): return context +from django.views.generic.detail import DetailView +class UserDetailView(DetailView): + """ + Classed based view to show a specific user in the interface. + """ + model = User + + +class GroupDetailView(DetailView): + """ + Classed based view to show a specific group in the interface. + """ + model = Group + + class UserCreateView(CreateView): """ Create a new participant. @@ -354,7 +369,7 @@ class ResetPasswordView(RedirectView, SingleObjectMixin, QuestionMixin): return reverse('user_reset_password', args=[self.object.id]) -class GroupOverviewView(ListView): +class GroupOverview(ListView): """ Overview over all groups. """ From b213e75223385a4a1037c65eeddeec6a25566099 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Norman=20J=C3=A4ckel?= Date: Mon, 29 Oct 2012 10:16:12 +0100 Subject: [PATCH 10/13] Enhancement to ticket # 389 (Message on assignment slide when no vote results yet available) --- openslides/assignment/models.py | 5 +++-- openslides/assignment/templates/projector/Assignment.html | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/openslides/assignment/models.py b/openslides/assignment/models.py index 9d2cf8814..4b86b75cf 100644 --- a/openslides/assignment/models.py +++ b/openslides/assignment/models.py @@ -227,11 +227,12 @@ class Assignment(models.Model, SlideMixin): """ return the slide dict """ + polls = self.poll_set data = super(Assignment, self).slide() data['assignment'] = self data['title'] = self.name - data['polls_available'] = self.poll_set.exists() - data['polls'] = self.poll_set.filter(published=True) + data['some_polls_available'] = polls.exists() + data['polls'] = polls.filter(published=True) data['vote_results'] = self.vote_results(only_published=True) data['assignment_publish_winner_results_only'] = \ config['assignment_publish_winner_results_only'] diff --git a/openslides/assignment/templates/projector/Assignment.html b/openslides/assignment/templates/projector/Assignment.html index 181597a9f..8cf59860c 100644 --- a/openslides/assignment/templates/projector/Assignment.html +++ b/openslides/assignment/templates/projector/Assignment.html @@ -122,7 +122,7 @@ - {% elif polls_available %} + {% elif some_polls_available %} {% trans "Vote results are not published yet." %} {% elif assignment.candidates %} {% trans "No ballots available." %} From c13f4ba52d03dcf2fe73174d440fb0e0bdcc7792 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Norman=20J=C3=A4ckel?= Date: Tue, 30 Oct 2012 00:07:25 +0100 Subject: [PATCH 11/13] Add UserView and GroupView part 2 --- openslides/participant/models.py | 10 +++- .../participant/base_participant.html | 47 +++++++++++++++++++ .../templates/participant/group_detail.html | 15 +++++- .../templates/participant/group_overview.html | 3 +- .../templates/participant/group_widget.html | 2 +- .../templates/participant/overview.html | 2 +- .../templates/participant/user_detail.html | 35 +++++++++++++- .../templates/participant/user_widget.html | 2 +- openslides/participant/urls.py | 4 +- openslides/participant/views.py | 12 +++-- 10 files changed, 117 insertions(+), 15 deletions(-) diff --git a/openslides/participant/models.py b/openslides/participant/models.py index cabb54b7a..2490b89d7 100644 --- a/openslides/participant/models.py +++ b/openslides/participant/models.py @@ -78,14 +78,17 @@ class User(DjangoUser, PersonMixin, Person): self.save() @models.permalink - def get_absolute_url(self, link='edit'): + def get_absolute_url(self, link='view'): """ Return the URL to this user. link can be: + * view * edit * delete """ + if link == 'view': + return ('user_view', [str(self.id)]) if link == 'edit': return ('user_edit', [str(self.id)]) if link == 'delete': @@ -114,14 +117,17 @@ class Group(DjangoGroup, PersonMixin, Person): description = models.TextField(blank=True) @models.permalink - def get_absolute_url(self, link='edit'): + def get_absolute_url(self, link='view'): """ Return the URL to this user. link can be: + * view * edit * delete """ + if link == 'view': + return ('user_group_view', [str(self.id)]) if link == 'edit': return ('user_group_edit', [str(self.id)]) if link == 'delete': diff --git a/openslides/participant/templates/participant/base_participant.html b/openslides/participant/templates/participant/base_participant.html index bb726731d..d9fc3adeb 100644 --- a/openslides/participant/templates/participant/base_participant.html +++ b/openslides/participant/templates/participant/base_participant.html @@ -27,4 +27,51 @@
  • {% trans 'First time passwords as PDF' %}
  • {% endif %} + + {# second submenu #} + {% if shown_user %} +
    +

    {{ shown_user.clean_name }}

    + + {% elif group %} +
    +

    {{ group.name }}

    + + {% endif %} + {% endblock %} diff --git a/openslides/participant/templates/participant/group_detail.html b/openslides/participant/templates/participant/group_detail.html index 770380218..3a7f748f4 100644 --- a/openslides/participant/templates/participant/group_detail.html +++ b/openslides/participant/templates/participant/group_detail.html @@ -1,9 +1,20 @@ {% extends "participant/base_participant.html" %} -{% block title %}{{ block.super }} – {{ object }}{% endblock %} +{% load i18n %} +{% load tags %} + +{% block title %}{{ block.super }} – {{ group }}{% endblock %} {% block content %} -{{ object }} +

    {{ group }}

    + +

    {{ group.description }}

    + +

    {% trans "Members" %}

    + +{% for member in group.user_set.all %} +

    {{ member }}

    +{% endfor %} {% endblock %} diff --git a/openslides/participant/templates/participant/group_overview.html b/openslides/participant/templates/participant/group_overview.html index 3745308fb..c226f7ec1 100644 --- a/openslides/participant/templates/participant/group_overview.html +++ b/openslides/participant/templates/participant/group_overview.html @@ -2,6 +2,7 @@ {% load i18n %} {% load staticfiles %} +{% load tags %} {% block title %}{{ block.super }} – {% trans "User groups" %}{% endblock %} @@ -14,7 +15,7 @@ {% for group in groups %} - {{ group.name }} + {{ group.name }} {% if group.name != 'Anonymous' %} diff --git a/openslides/participant/templates/participant/group_widget.html b/openslides/participant/templates/participant/group_widget.html index 5900ef547..50cd7e6b6 100644 --- a/openslides/participant/templates/participant/group_widget.html +++ b/openslides/participant/templates/participant/group_widget.html @@ -17,7 +17,7 @@ - {{ group }} + {{ group }} {% endif %} {% empty %} diff --git a/openslides/participant/templates/participant/overview.html b/openslides/participant/templates/participant/overview.html index f950bc302..0066b1dbe 100644 --- a/openslides/participant/templates/participant/overview.html +++ b/openslides/participant/templates/participant/overview.html @@ -76,7 +76,7 @@ {% for user in users %} - {{ user.first_name }} + {{ user.first_name }} {{ user.last_name }} {{ user.detail }} {{ user.get_type_display }} diff --git a/openslides/participant/templates/participant/user_detail.html b/openslides/participant/templates/participant/user_detail.html index 770380218..379248bc1 100644 --- a/openslides/participant/templates/participant/user_detail.html +++ b/openslides/participant/templates/participant/user_detail.html @@ -1,9 +1,40 @@ {% extends "participant/base_participant.html" %} -{% block title %}{{ block.super }} – {{ object }}{% endblock %} +{% load i18n %} +{% load tags %} + +{% block title %}{{ block.super }} – {{ shown_user }}{% endblock %} {% block content %} -{{ object }} +

    {{ shown_user }}

    + +

    {{ shown_user.email }}

    + +

    {% trans "Groups" %}

    +

    + {% for group in shown_user.groups.all %} + {{ group }}, + {% endfor %} +

    + +

    {% trans "Gender" %}

    +

    {{ shown_user.get_gender_display }}

    + +

    {% trans "Type" %}

    +

    {{ shown_user.get_type_display }}

    + +

    {% trans "Committee" %}

    +

    {{ shown_user.committee }}

    + +{% if perms.participant.can_manage_participant %} +

    {% trans "Comment" %}

    +

    {{ shown_user.comment }}

    + +

    {% trans "Last Login" %}

    + {% if shown_user.last_login > shown_user.date_joined %} +

    {{ shown_user.last_login }}

    + {% endif %} +{% endif %} {% endblock %} diff --git a/openslides/participant/templates/participant/user_widget.html b/openslides/participant/templates/participant/user_widget.html index 21e0db5a9..e8657cb17 100644 --- a/openslides/participant/templates/participant/user_widget.html +++ b/openslides/participant/templates/participant/user_widget.html @@ -16,7 +16,7 @@ - {{ user }} + {{ user }} {% empty %}
  • {% trans 'No users available.' %}
  • diff --git a/openslides/participant/urls.py b/openslides/participant/urls.py index ed98c45c5..e3ac2e553 100644 --- a/openslides/participant/urls.py +++ b/openslides/participant/urls.py @@ -34,7 +34,7 @@ urlpatterns = patterns('', url(r'^(?P\d+)/$', UserDetailView.as_view(), - name='user_detail', + name='user_view', ), url(r'^(?P\d+)/edit/$', @@ -88,7 +88,7 @@ urlpatterns = patterns('', url(r'^group/(?P\d+)/$', GroupDetailView.as_view(), - name='user_group_detail', + name='user_group_view', ), url(r'^group/(?P\d+)/edit/$', diff --git a/openslides/participant/views.py b/openslides/participant/views.py index 4fa817128..854b59b31 100644 --- a/openslides/participant/views.py +++ b/openslides/participant/views.py @@ -140,19 +140,25 @@ class UserOverview(ListView): return context -from django.views.generic.detail import DetailView -class UserDetailView(DetailView): +from openslides.utils.views import DetailView, PermissionMixin +class UserDetailView(DetailView, PermissionMixin): """ Classed based view to show a specific user in the interface. """ + permission_required = 'participant.can_see_participant' model = User + template_name = 'participant/user_detail.html' + context_object_name = 'shown_user' -class GroupDetailView(DetailView): +class GroupDetailView(DetailView, PermissionMixin): """ Classed based view to show a specific group in the interface. """ + permission_required = 'participant.can_manage_participant' model = Group + template_name = 'participant/group_detail.html' + context_object_name = 'group' class UserCreateView(CreateView): From ac25e02e2d7a7b3105f3961e6cd854b8a572e7f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Norman=20J=C3=A4ckel?= Date: Wed, 31 Oct 2012 14:38:06 +0100 Subject: [PATCH 12/13] Catch another IOError in get_version() --- openslides/__init__.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/openslides/__init__.py b/openslides/__init__.py index 17d119cf0..69d7f23e4 100644 --- a/openslides/__init__.py +++ b/openslides/__init__.py @@ -31,11 +31,10 @@ def get_version(version=None): sub = mapping[version[3]] + str(version[4]) try: git_head_path = '.git/' + open('.git/HEAD', 'r').read()[5:].rstrip() - except IOError: - git_commit_id = 'unknown' - else: import os git_commit_id = open(os.path.abspath(git_head_path), 'r').read().rstrip() + except IOError: + git_commit_id = 'unknown' sub = '%s commit %s' % (sub, git_commit_id) else: sub = '' From 3b4e19ad3b1e7fb47ff4c1a1f06648aa4464ce7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Norman=20J=C3=A4ckel?= Date: Wed, 31 Oct 2012 14:47:42 +0100 Subject: [PATCH 13/13] Enhence template of UserView and GroupView --- .../templates/participant/group_detail.html | 2 ++ .../templates/participant/user_detail.html | 18 +++++++++++++++--- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/openslides/participant/templates/participant/group_detail.html b/openslides/participant/templates/participant/group_detail.html index 3a7f748f4..e4896ae17 100644 --- a/openslides/participant/templates/participant/group_detail.html +++ b/openslides/participant/templates/participant/group_detail.html @@ -15,6 +15,8 @@ {% for member in group.user_set.all %}

    {{ member }}

    +{% empty %} +

    {% trans "This group has not any members." %}

    {% endfor %} {% endblock %} diff --git a/openslides/participant/templates/participant/user_detail.html b/openslides/participant/templates/participant/user_detail.html index 379248bc1..b7a0e50ff 100644 --- a/openslides/participant/templates/participant/user_detail.html +++ b/openslides/participant/templates/participant/user_detail.html @@ -14,26 +14,38 @@

    {% trans "Groups" %}

    {% for group in shown_user.groups.all %} - {{ group }}, + {{ group }}, + {% empty %} + {% trans "The participant is not member of any group." %} {% endfor %}

    -

    {% trans "Gender" %}

    -

    {{ shown_user.get_gender_display }}

    +{% if shown_user.get_gender_display %} +

    {% trans "Gender" %}

    +

    {{ shown_user.get_gender_display }}

    +{% endif %} +{% if shown_user.get_type_display %}

    {% trans "Type" %}

    {{ shown_user.get_type_display }}

    +{% endif %} +{% if shown_user.committee %}

    {% trans "Committee" %}

    {{ shown_user.committee }}

    +{% endif %} {% if perms.participant.can_manage_participant %} + {% if shown_user.comment %}

    {% trans "Comment" %}

    {{ shown_user.comment }}

    + {% endif %}

    {% trans "Last Login" %}

    {% if shown_user.last_login > shown_user.date_joined %}

    {{ shown_user.last_login }}

    + {% else %} +

    {% trans "The participant was not logged in yet." %}

    {% endif %} {% endif %}