Code

Ticket #2581: flatpages-populate_xheaders.diff

File flatpages-populate_xheaders.diff, 770 bytes (added by dummy@…, 8 years ago)
Line 
1Index: django/contrib/flatpages/views.py
2===================================================================
3--- django/contrib/flatpages/views.py   (Revision 3636)
4+++ django/contrib/flatpages/views.py   (Arbeitskopie)
5@@ -2,6 +2,7 @@
6 from django.template import loader, RequestContext
7 from django.shortcuts import get_object_or_404
8 from django.http import HttpResponse
9+from django.core.xheaders import populate_xheaders
10 from django.conf import settings
11 
12 DEFAULT_TEMPLATE = 'flatpages/default.html'
13@@ -32,4 +33,6 @@
14     c = RequestContext(request, {
15         'flatpage': f,
16     })
17-    return HttpResponse(t.render(c))
18+    response = HttpResponse(t.render(c))
19+    populate_xheaders(request, response, FlatPage, getattr(f, f._meta.pk.name))
20+    return response