Serializing answers to form field
[edumed.git] / edumed / views.py
1 import os.path
2 from django.conf import settings
3 from django.views.generic import TemplateView
4 from django.views.defaults import page_not_found
5 from django.contrib.flatpages.views import flatpage
6 from pybb.views import ProfileEditView
7 from .forms import AvatarlessEditProfileForm
8
9
10 class HomeView(TemplateView):
11     template_name="home.html"
12
13     def get_context_data(self, **kwargs):
14         context = super(HomeView, self).get_context_data(**kwargs)
15         context['package_url'] = os.path.join(settings.MEDIA_URL, settings.CATALOGUE_PACKAGE)
16         context['package_student_url'] = os.path.join(settings.MEDIA_URL, settings.CATALOGUE_PACKAGE_STUDENT)
17         return context
18
19
20 def mil_home_view(request):
21     return flatpage(request, url = '/' if request.LANGUAGE_CODE == 'pl' else '/en/')
22
23 def mil_404_view(request):
24     return page_not_found(request, '404_mil.html')
25
26 def mil_contact_view(request):
27     return flatpage(request, url = '/kontakt_mil/' if request.LANGUAGE_CODE == 'pl' else '/contact_mil/')
28
29 def mil_knowledge_base_view(request, url):
30     return flatpage(request, url = 'bazawiedzy/' + url)
31
32 class AvatarlessProfileEditView(ProfileEditView):
33     form_class = AvatarlessEditProfileForm