From 26ac182cf59f0ab22f58135a73a9dddfd3eb8230 Mon Sep 17 00:00:00 2001 From: Tomas Neme Date: Fri, 16 Sep 2011 16:18:46 -0300 Subject: [PATCH 1/2] PEP-8 --- userprofile/views.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/userprofile/views.py b/userprofile/views.py index 41f429c..3ab34ca 100644 --- a/userprofile/views.py +++ b/userprofile/views.py @@ -3,9 +3,9 @@ from django.http import HttpResponseRedirect, HttpResponse from django.shortcuts import render_to_response, get_object_or_404 from django.utils.translation import ugettext as _ -from userprofile.forms import AvatarForm, AvatarCropForm, EmailValidationForm, \ - ProfileForm, RegistrationForm, LocationForm, \ - ResendEmailValidationForm, PublicFieldsForm +from userprofile.forms import (AvatarForm, AvatarCropForm, EmailValidationForm, + ProfileForm, RegistrationForm, LocationForm, + ResendEmailValidationForm, PublicFieldsForm) from userprofile.models import BaseProfile from django.http import Http404 from django.core.exceptions import ObjectDoesNotExist @@ -14,8 +14,9 @@ from django.utils import simplejson from django.db import models from django.contrib.auth.models import User, SiteProfileNotAvailable -from userprofile.models import EmailValidation, Avatar, UserProfileMediaNotFound, \ - GoogleDataAPINotFound, S3BackendNotFound +from userprofile.models import (EmailValidation, Avatar, + UserProfileMediaNotFound, GoogleDataAPINotFound, + S3BackendNotFound) from django.template import RequestContext from cStringIO import StringIO from django.core.files.base import ContentFile From 0f2be7635cbf5a760e695af04dccb7c2ae024bf8 Mon Sep 17 00:00:00 2001 From: Tomas Neme Date: Fri, 16 Sep 2011 16:19:06 -0300 Subject: [PATCH 2/2] added csrf_token to form --- .../templates/userprofile/account/login.html | 71 ++++++++++--------- 1 file changed, 36 insertions(+), 35 deletions(-) diff --git a/userprofile/templates/userprofile/account/login.html b/userprofile/templates/userprofile/account/login.html index f0219b9..690b341 100644 --- a/userprofile/templates/userprofile/account/login.html +++ b/userprofile/templates/userprofile/account/login.html @@ -6,46 +6,47 @@ {% block extrajs %} {% endblock %} {% block userprofile_content %} -
-
- {% trans "User login" %} - -

{{ form.username }} - {% if form.username.errors %} - {{ form.username.html_error_list }} - {% endif %} -

- -

{{ form.password }} - {% if form.password.errors %} - {{ form.password.html_error_list }} - {% endif %} -

- {% if form.non_field_errors %} -
    {{ form.non_field_errors.as_ul }}
- {% endif %} -
-

-
+
+ {% csrf_token %} +
+ {% trans "User login" %} + +

{{ form.username }} + {% if form.username.errors %} + {{ form.username.html_error_list }} + {% endif %} +

+ +

{{ form.password }} + {% if form.password.errors %} + {{ form.password.html_error_list }} + {% endif %} +

+ {% if form.non_field_errors %} +
    {{ form.non_field_errors.as_ul }}
+ {% endif %} +
+

+
{% endblock %} {% block userprofile_content_related %} -
-

{% trans "Utilities" %}:

- {# http://code.djangoproject.com/ticket/7239 #} - {% trans "Lost your password?" %} -
- {% trans "Resend validation e-mail" %} -
- {% trans "Sign up!" %} -
-
+
+

{% trans "Utilities" %}:

+ {# http://code.djangoproject.com/ticket/7239 #} + {% trans "Lost your password?" %} +
+ {% trans "Resend validation e-mail" %} +
+ {% trans "Sign up!" %} +
+
{% endblock %}