question of type wybor with an open part
[edumed.git] / comment / views.py
1 from django.views.generic import ListView, DetailView
2 from django.conf import settings
3 from django.utils.translation import get_language
4
5 from django.core.urlresolvers import reverse
6
7 from .models import CommentDocument
8
9
10 class CommentDocumentList(ListView):
11     model = CommentDocument
12
13     def get_queryset(self, **kwargs):
14         return super(CommentDocumentList, self).get_queryset(**kwargs).filter(language_code = get_language())
15
16     def get_context_data(self, **kwargs):
17         context = super(CommentDocumentList, self).get_context_data(**kwargs)
18         context['form_href'] = reverse('contact_form', kwargs = dict(form_tag = 'mil'))
19         return context
20
21
22 class CommentDocument(DetailView):
23     model = CommentDocument
24
25     def get_context_data(self, **kwargs):
26         context = super(CommentDocument, self).get_context_data(**kwargs)
27         context['comment_url'] = settings.COMMENT_URL
28         return context