X-Git-Url: https://git.mdrn.pl/edumed.git/blobdiff_plain/9beb8b9bcc4902c8100f4ecf28d4e025e99a4195..a638f0a8038186e7a07096702e53c8efbee83092:/comment/views.py?ds=inline diff --git a/comment/views.py b/comment/views.py index 748f9c4..1471029 100644 --- a/comment/views.py +++ b/comment/views.py @@ -1,5 +1,8 @@ from django.views.generic import ListView, DetailView from django.conf import settings +from django.utils.translation import get_language + +from django.core.urlresolvers import reverse from .models import CommentDocument @@ -7,6 +10,14 @@ from .models import CommentDocument class CommentDocumentList(ListView): model = CommentDocument + def get_queryset(self, **kwargs): + return super(CommentDocumentList, self).get_queryset(**kwargs).filter(language_code = get_language()) + + def get_context_data(self, **kwargs): + context = super(CommentDocumentList, self).get_context_data(**kwargs) + context['form_href'] = reverse('contact_form', kwargs = dict(form_tag = 'mil')) + return context + class CommentDocument(DetailView): model = CommentDocument