Default sorting of applications using Meta Class

This commit is contained in:
Norman Jäckel 2012-09-14 01:14:25 +02:00
parent 77ae543ff2
commit cb3b26c45d
2 changed files with 4 additions and 3 deletions

View File

@ -534,6 +534,7 @@ class Application(models.Model, SlideMixin):
('can_support_application', ugettext_noop("Can support motions")),
('can_manage_application', ugettext_noop("Can manage motions")),
)
ordering = ('number',)
class AVersion(models.Model):

View File

@ -103,7 +103,7 @@ def overview(request):
# limit result to last version of an application
query = query.filter(aversion__id__in=[x.last_version.id for x in Application.objects.all()])
else:
query = query.order_by('number')
pass
if 'reverse' in sortfilter:
query = query.reverse()
@ -681,7 +681,7 @@ class ApplicationPDF(PDFView):
if preamble:
story.append(Paragraph("%s" % preamble.replace('\r\n','<br/>'), stylesheet['Paragraph']))
story.append(Spacer(0,0.75*cm))
applications = Application.objects.order_by('number')
applications = Application.objects.all()
if not applications: # No applications existing
story.append(Paragraph(_("No motions available."), stylesheet['Heading3']))
else: # Print all Applications
@ -899,5 +899,5 @@ def get_widgets(request):
Widget(
name='applications',
template='application/widget.html',
context={'applications': Application.objects.all().order_by('number')},
context={'applications': Application.objects.all()},
permission_required='application.can_manage_application')]