Commit 7003ff48 authored by Michal Čihař's avatar Michal Čihař

Basic changes filtering (issue #192)

parent 5f34b3cb
......@@ -20,6 +20,7 @@
from django.views.generic.list import ListView
from trans.models.changes import Change
from trans.views.helper import get_project_translation
class ChangesView(ListView):
'''
......@@ -31,4 +32,20 @@ class ChangesView(ListView):
'''
Returns list of changes to browse.
'''
return Change.objects.all()
project, subproject, translation = get_project_translation(
self.request,
self.request.GET.get('project', None),
self.request.GET.get('subproject', None),
self.request.GET.get('lang', None),
)
result = Change.objects.all()
if translation is not None:
result = result.filter(translation=translation)
elif subproject is not None:
result = result.filter(translation__subproject=subproject)
elif project is not None:
result = result.filter(translation__subproject__project=project)
return result
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment