Merge pull request #12 from normanjaeckel/sorting_elements_in_widgets

Sorting elements in widgets and in the application overview
This commit is contained in:
Oskar Hahn 2012-09-11 00:46:36 -07:00
commit e2f87f23ac
2 changed files with 4 additions and 3 deletions

View File

@ -99,10 +99,11 @@ def overview(request):
else:
sort = sortfilter['sort']
query = query.order_by(sort)
if sort.startswith('aversion_'):
# 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')
if 'reverse' in sortfilter:
query = query.reverse()
@ -920,5 +921,5 @@ def get_widgets(request):
Widget(
name='applications',
template='application/widget.html',
context={'applications': Application.objects.all()},
context={'applications': Application.objects.all().order_by('number')},
permission_required='application.can_manage_application')]

View File

@ -660,5 +660,5 @@ def get_widgets(request):
Widget(
name=_('Assignments'),
template='assignment/widget.html',
context={'assignments': Assignment.objects.all()},
context={'assignments': Assignment.objects.all().order_by('name')},
permission_required='assignment.can_manage_assignment')]