[#4773] Lien vers chercheurs et ressources similaire
[auf_savoirs_en_partage_django.git] / auf_savoirs_en_partage / views.py
1 # -*- encoding: utf-8 -*-
2
3 from django.shortcuts import render_to_response
4 from django.template import RequestContext
5 from django.views.generic import TemplateView
6 from django.contrib.sites.models import Site
7
8
9 def page_404(request):
10 return render_to_response("404.html", context_instance = RequestContext(request))
11
12
13 def page_500(request):
14 return render_to_response("500.html", context_instance = RequestContext(request))
15
16
17 class RobotsTxtView(TemplateView):
18
19 template_name = 'robots.txt'
20
21 def get_context_data(self, **kwargs):
22 context = super(RobotsTxtView, self).get_context_data(**kwargs)
23 context['domain'] = Site.objects.get_current().domain
24 return context
25
26 def render_to_response(self, context, **response_kwargs):
27 response_kwargs['content_type'] = 'text/plain'
28 return super(RobotsTxtView, self).render_to_response(context, **response_kwargs)