|
1 from django.core import context_processors |
|
2 from django.shortcuts import render_to_response |
|
3 from django.template.context import RequestContext |
|
4 |
|
5 |
|
6 def request_processor(request): |
|
7 return render_to_response('context_processors/request_attrs.html', |
|
8 RequestContext(request, {}, processors=[context_processors.request])) |
|
9 |
|
10 def auth_processor_no_attr_access(request): |
|
11 r1 = render_to_response('context_processors/auth_attrs_no_access.html', |
|
12 RequestContext(request, {}, processors=[context_processors.auth])) |
|
13 # *After* rendering, we check whether the session was accessed |
|
14 return render_to_response('context_processors/auth_attrs_test_access.html', |
|
15 {'session_accessed':request.session.accessed}) |
|
16 |
|
17 def auth_processor_attr_access(request): |
|
18 r1 = render_to_response('context_processors/auth_attrs_access.html', |
|
19 RequestContext(request, {}, processors=[context_processors.auth])) |
|
20 return render_to_response('context_processors/auth_attrs_test_access.html', |
|
21 {'session_accessed':request.session.accessed}) |
|
22 |
|
23 def auth_processor_user(request): |
|
24 return render_to_response('context_processors/auth_attrs_user.html', |
|
25 RequestContext(request, {}, processors=[context_processors.auth])) |
|
26 |
|
27 def auth_processor_perms(request): |
|
28 return render_to_response('context_processors/auth_attrs_perms.html', |
|
29 RequestContext(request, {}, processors=[context_processors.auth])) |
|
30 |
|
31 def auth_processor_messages(request): |
|
32 request.user.message_set.create(message="Message 1") |
|
33 return render_to_response('context_processors/auth_attrs_messages.html', |
|
34 RequestContext(request, {}, processors=[context_processors.auth])) |
|
35 |
|
36 def userpage(request): |
|
37 pass |