From 77ae543ff201c314e93b96435e758bfd3a52f87d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Norman=20J=C3=A4ckel?= Date: Fri, 14 Sep 2012 00:21:59 +0200 Subject: [PATCH] Using Meta Class for ordering assignments by name --- openslides/assignment/models.py | 1 + openslides/assignment/views.py | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/openslides/assignment/models.py b/openslides/assignment/models.py index 2a15f271f..dcd8a6e15 100644 --- a/openslides/assignment/models.py +++ b/openslides/assignment/models.py @@ -253,6 +253,7 @@ class Assignment(models.Model, SlideMixin): ('can_nominate_self', ugettext_noop("Can nominate themselves")), ('can_manage_assignment', ugettext_noop("Can manage assignment")), ) + ordering = ('name',) register_slidemodel(Assignment) diff --git a/openslides/assignment/views.py b/openslides/assignment/views.py index 26a7a0bf5..2b7ff4a71 100644 --- a/openslides/assignment/views.py +++ b/openslides/assignment/views.py @@ -59,7 +59,7 @@ def get_overview(request): if sort in ['name','status']: query = query.order_by(sort) except KeyError: - query = query.order_by('name') + pass if 'reverse' in request.GET: query = query.reverse() @@ -353,7 +353,7 @@ class AssignmentPDF(PDFView): story.append(Paragraph("%s" % preamble.replace('\r\n', '
'), stylesheet['Paragraph'])) story.append(Spacer(0, 0.75 * cm)) - assignments = Assignment.objects.order_by('name') + assignments = Assignment.objects.all() if not assignments: # No assignments existing story.append(Paragraph(_("No assignments available."), stylesheet['Heading3'])) @@ -675,5 +675,5 @@ def get_widgets(request): Widget( name=_('Assignments'), template='assignment/widget.html', - context={'assignments': Assignment.objects.all().order_by('name')}, + context={'assignments': Assignment.objects.all()}, permission_required='assignment.can_manage_assignment')]