[#4773] Lien vers chercheurs et ressources similaire
[auf_savoirs_en_partage_django.git] / auf_savoirs_en_partage / views.py
CommitLineData
1e28a70a 1# -*- encoding: utf-8 -*-
2
3from django.shortcuts import render_to_response
4from django.template import RequestContext
9f43a123
PP
5from django.views.generic import TemplateView
6from django.contrib.sites.models import Site
7
1e28a70a 8
9def page_404(request):
10 return render_to_response("404.html", context_instance = RequestContext(request))
11
9f43a123 12
1e28a70a 13def page_500(request):
14 return render_to_response("500.html", context_instance = RequestContext(request))
9f43a123
PP
15
16
17class 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)