X-Git-Url: https://git.mdrn.pl/edumed.git/blobdiff_plain/9beb8b9bcc4902c8100f4ecf28d4e025e99a4195..695023a09f7ed62d3a414dfc7c7b909fd0d1171b:/comment/views.py?ds=sidebyside diff --git a/comment/views.py b/comment/views.py index 748f9c4..40db4b0 100644 --- a/comment/views.py +++ b/comment/views.py @@ -1,15 +1,27 @@ +# -*- coding: utf-8 -*- from django.views.generic import ListView, DetailView from django.conf import settings +from django.utils.translation import get_language -from .models import CommentDocument +from django.core.urlresolvers import reverse + +from .models import CommentDocument as CommentDocumentModel class CommentDocumentList(ListView): - model = CommentDocument + model = CommentDocumentModel + + def get_queryset(self): + return super(CommentDocumentList, self).get_queryset().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={'form_tag': 'mil'}) + return context class CommentDocument(DetailView): - model = CommentDocument + model = CommentDocumentModel def get_context_data(self, **kwargs): context = super(CommentDocument, self).get_context_data(**kwargs)