Default sorting of applications using Meta Class
This commit is contained in:
parent
77ae543ff2
commit
cb3b26c45d
@ -534,6 +534,7 @@ class Application(models.Model, SlideMixin):
|
|||||||
('can_support_application', ugettext_noop("Can support motions")),
|
('can_support_application', ugettext_noop("Can support motions")),
|
||||||
('can_manage_application', ugettext_noop("Can manage motions")),
|
('can_manage_application', ugettext_noop("Can manage motions")),
|
||||||
)
|
)
|
||||||
|
ordering = ('number',)
|
||||||
|
|
||||||
|
|
||||||
class AVersion(models.Model):
|
class AVersion(models.Model):
|
||||||
|
@ -103,7 +103,7 @@ def overview(request):
|
|||||||
# limit result to last version of an application
|
# limit result to last version of an application
|
||||||
query = query.filter(aversion__id__in=[x.last_version.id for x in Application.objects.all()])
|
query = query.filter(aversion__id__in=[x.last_version.id for x in Application.objects.all()])
|
||||||
else:
|
else:
|
||||||
query = query.order_by('number')
|
pass
|
||||||
|
|
||||||
if 'reverse' in sortfilter:
|
if 'reverse' in sortfilter:
|
||||||
query = query.reverse()
|
query = query.reverse()
|
||||||
@ -681,7 +681,7 @@ class ApplicationPDF(PDFView):
|
|||||||
if preamble:
|
if preamble:
|
||||||
story.append(Paragraph("%s" % preamble.replace('\r\n','<br/>'), stylesheet['Paragraph']))
|
story.append(Paragraph("%s" % preamble.replace('\r\n','<br/>'), stylesheet['Paragraph']))
|
||||||
story.append(Spacer(0,0.75*cm))
|
story.append(Spacer(0,0.75*cm))
|
||||||
applications = Application.objects.order_by('number')
|
applications = Application.objects.all()
|
||||||
if not applications: # No applications existing
|
if not applications: # No applications existing
|
||||||
story.append(Paragraph(_("No motions available."), stylesheet['Heading3']))
|
story.append(Paragraph(_("No motions available."), stylesheet['Heading3']))
|
||||||
else: # Print all Applications
|
else: # Print all Applications
|
||||||
@ -899,5 +899,5 @@ def get_widgets(request):
|
|||||||
Widget(
|
Widget(
|
||||||
name='applications',
|
name='applications',
|
||||||
template='application/widget.html',
|
template='application/widget.html',
|
||||||
context={'applications': Application.objects.all().order_by('number')},
|
context={'applications': Application.objects.all()},
|
||||||
permission_required='application.can_manage_application')]
|
permission_required='application.can_manage_application')]
|
||||||
|
Loading…
Reference in New Issue
Block a user