From 760f8e042eff2b9f99a56574e7b2b989b79a6d6d Mon Sep 17 00:00:00 2001 From: Oskar Hahn Date: Wed, 12 Sep 2012 10:17:51 +0200 Subject: [PATCH] some fixes --- openslides/application/models.py | 6 +++--- openslides/application/views.py | 6 +++--- openslides/assignment/models.py | 9 +++++---- openslides/assignment/views.py | 8 ++++---- openslides/participant/forms.py | 2 +- .../participant/templates/participant/overview.html | 2 +- openslides/poll/models.py | 2 +- 7 files changed, 18 insertions(+), 17 deletions(-) diff --git a/openslides/application/models.py b/openslides/application/models.py index 4c06b55a6..3a4e901be 100644 --- a/openslides/application/models.py +++ b/openslides/application/models.py @@ -264,7 +264,7 @@ class Application(models.Model, SlideMixin): ApplicationSupporter(application=self, person=person).save() self.writelog(_("Supporter: +%s") % (person)) - def unsupport(self, user): + def unsupport(self, person): """ remove a supporter from the list of supporters of the application """ @@ -272,11 +272,11 @@ class Application(models.Model, SlideMixin): # TODO: Use own Exception raise NameError('This application is already permitted.') try: - object = self.applicationsupporter_set.get(user=user).delete() + object = self.applicationsupporter_set.get(person=person).delete() except ApplicationSupporter.DoesNotExist: pass else: - self.writelog(_("Supporter: -%s") % (user)) + self.writelog(_("Supporter: -%s") % (person)) def set_number(self, number=None, user=None): """ diff --git a/openslides/application/views.py b/openslides/application/views.py index f702eb53b..e8a019875 100644 --- a/openslides/application/views.py +++ b/openslides/application/views.py @@ -264,7 +264,7 @@ def edit(request, application_id=None): if request.user.has_perm('application.can_manage_application'): messages.warning(request, _("Attention: Do you really want to edit this motion? The supporters will not be removed automatically because you can manage motions. Please check if the supports are valid after your changing!")) else: - messages.warning(request, _("Attention: Do you really want to edit this motion? All %s supporters will be removed! Try to convince the supporters again.") % application.supporter.count() ) + messages.warning(request, _("Attention: Do you really want to edit this motion? All %s supporters will be removed! Try to convince the supporters again.") % application.count_supporters() ) initial = {'title': application.title, 'text': application.text, 'reason': application.reason} @@ -372,7 +372,7 @@ def support(request, application_id): support an application. """ try: - Application.objects.get(pk=application_id).support(user=request.user) + Application.objects.get(pk=application_id).support(person=request.user) messages.success(request, _("You have support the motion successfully.") ) except Application.DoesNotExist: pass @@ -386,7 +386,7 @@ def unsupport(request, application_id): unsupport an application. """ try: - Application.objects.get(pk=application_id).unsupport(user=request.user) + Application.objects.get(pk=application_id).unsupport(person=request.user) messages.success(request, _("You have unsupport the motion successfully.") ) except Application.DoesNotExist: pass diff --git a/openslides/assignment/models.py b/openslides/assignment/models.py index accfc2105..7b7064ef1 100644 --- a/openslides/assignment/models.py +++ b/openslides/assignment/models.py @@ -131,9 +131,7 @@ class Assignment(models.Model, SlideMixin): def get_participants(self, only_elected=False, only_candidate=False): candidates = self.assignment_candidats.exclude(blocked=True) - if only_elected and only_candidate: - # TODO: Use right Exception - raise Exception("only_elected and only_candidate can not both be Treu") + assert not (only_elected and only_candidate) if only_elected: candidates = candidates.filter(elected=True) @@ -141,8 +139,11 @@ class Assignment(models.Model, SlideMixin): if only_candidate: candidates = candidates.filter(elected=False) + participants = [] for candidate in candidates.all(): - yield candidate.person + participants.append(candidate.person) + return participants + #return candidates.values_list('person', flat=True) def set_elected(self, person, value=True): diff --git a/openslides/assignment/views.py b/openslides/assignment/views.py index 83b5e04c5..5271750c4 100644 --- a/openslides/assignment/views.py +++ b/openslides/assignment/views.py @@ -421,8 +421,8 @@ class AssignmentPDF(PDFView): candidate_string = candidate.user.get_full_name() if candidate in elected_candidates: candidate_string = "* " + candidate_string - if candidate.group: - candidate_string += "\n(%s)" % candidate.group + if candidate.category: + candidate_string += "\n(%s)" % candidate.category row.append(candidate_string) for vote in poll_list: if vote == None: @@ -581,8 +581,8 @@ class AssignmentPollPDF(PDFView): candidate = option.candidate cell.append(Paragraph(circle + candidate.user.get_full_name(), stylesheet['Ballot_option_name'])) - if candidate.group: - cell.append(Paragraph("(%s)" % candidate.group, + if candidate.category: + cell.append(Paragraph("(%s)" % candidate.category, stylesheet['Ballot_option_group_right'])) else: cell.append(Paragraph(" ", diff --git a/openslides/participant/forms.py b/openslides/participant/forms.py index 4fb13a570..aedff5126 100644 --- a/openslides/participant/forms.py +++ b/openslides/participant/forms.py @@ -94,7 +94,7 @@ class GroupForm(forms.ModelForm, CssClassMixin): class UsersettingsForm(forms.ModelForm, CssClassMixin): class Meta: model = User - fields = ('username', 'first_name', 'last_name', 'email') + fields = ('username', 'first_name', 'last_name', 'email', 'gender') class UserImportForm(forms.Form, CssClassMixin): diff --git a/openslides/participant/templates/participant/overview.html b/openslides/participant/templates/participant/overview.html index 3e2762a37..452bdcb53 100644 --- a/openslides/participant/templates/participant/overview.html +++ b/openslides/participant/templates/participant/overview.html @@ -65,7 +65,7 @@ {% trans "First Name" %} {% trans "Last Name" %} - {% trans "Category" %} + {% trans "Category" %} {% trans "Type" %} {% trans "Committee" %} {% if perms.participant.can_manage_participant %} diff --git a/openslides/poll/models.py b/openslides/poll/models.py index add325b66..a38514619 100644 --- a/openslides/poll/models.py +++ b/openslides/poll/models.py @@ -236,7 +236,7 @@ def print_value(value, percent_base=0): elif value == -2: return unicode(_('undocumented')) elif value is None: - return u'' + return unicode(_('undocumented')) if not percent_base: return u'%s' % value