fix sciezki kopernika test form
[edumed.git] / comment / views.py
1 # -*- coding: utf-8 -*-
2 from django.views.generic import ListView, DetailView
3 from django.conf import settings
4 from django.utils.translation import get_language
5
6 from django.core.urlresolvers import reverse
7
8 from .models import CommentDocument as CommentDocumentModel
9
10
11 class CommentDocumentList(ListView):
12     model = CommentDocumentModel
13
14     def get_queryset(self):
15         return super(CommentDocumentList, self).get_queryset().filter(language_code=get_language())
16
17     def get_context_data(self, **kwargs):
18         context = super(CommentDocumentList, self).get_context_data(**kwargs)
19         context['form_href'] = reverse('contact_form', kwargs={'form_tag': 'mil'})
20         return context
21
22
23 class CommentDocument(DetailView):
24     model = CommentDocumentModel
25
26     def get_context_data(self, **kwargs):
27         context = super(CommentDocument, self).get_context_data(**kwargs)
28         context['comment_url'] = settings.COMMENT_URL
29         return context