Merge lp:~lukasz-czyzykowski/twitbuntu/csrf-error-fix into lp:twitbuntu

Proposed by Łukasz Czyżykowski
Status: Merged
Approved by: Łukasz Czyżykowski
Approved revision: 22
Merged at revision: 23
Proposed branch: lp:~lukasz-czyzykowski/twitbuntu/csrf-error-fix
Merge into: lp:twitbuntu
Diff against target: 44 lines (+12/-0)
3 files modified
settings.py (+10/-0)
templates/home.html (+1/-0)
templates/registration/login.html (+1/-0)
To merge this branch: bzr merge lp:~lukasz-czyzykowski/twitbuntu/csrf-error-fix
Reviewer Review Type Date Requested Status
Łukasz Czyżykowski Approve
Review via email: mp+34899@code.launchpad.net

Commit message

Fixed CSRF error caused by change in Django 1.2

To post a comment you must log in.
Revision history for this message
Łukasz Czyżykowski (lukasz-czyzykowski) wrote :

OK

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'settings.py'
2--- settings.py 2009-09-02 14:04:07 +0000
3+++ settings.py 2010-09-08 19:48:45 +0000
4@@ -61,6 +61,16 @@
5 'django.middleware.common.CommonMiddleware',
6 'django.contrib.sessions.middleware.SessionMiddleware',
7 'django.contrib.auth.middleware.AuthenticationMiddleware',
8+ 'django.middleware.csrf.CsrfViewMiddleware',
9+)
10+
11+TEMPLATE_CONTEXT_PROCESSORS = (
12+ 'django.core.context_processors.csrf',
13+ "django.contrib.auth.context_processors.auth",
14+ "django.core.context_processors.debug",
15+ "django.core.context_processors.i18n",
16+ "django.core.context_processors.media",
17+ "django.contrib.messages.context_processors.messages"
18 )
19
20 ROOT_URLCONF = 'twitbuntu.urls'
21
22=== modified file 'templates/home.html'
23--- templates/home.html 2010-04-09 15:13:48 +0000
24+++ templates/home.html 2010-09-08 19:48:45 +0000
25@@ -3,6 +3,7 @@
26
27 {% block content %}
28 <form action="" method="post">
29+ {% csrf_token %}
30 <table>
31 {{ form }}
32 <tr><td colspan="2"><input type="submit" value="{% trans 'Update' %}"/></td></tr>
33
34=== modified file 'templates/registration/login.html'
35--- templates/registration/login.html 2010-04-09 15:13:48 +0000
36+++ templates/registration/login.html 2010-09-08 19:48:45 +0000
37@@ -6,6 +6,7 @@
38 {% endif %}
39
40 <form method="post" action="{% url django.contrib.auth.views.login %}">
41+{% csrf_token %}
42 <table>
43 <tr>
44 <td>{{ form.username.label_tag }}</td>

Subscribers

People subscribed via source and target branches

to all changes: