Lots of updates for Django 1.5 support, including url tag fixes, and django-registration upgrades.

master
Nick Sergeant 2013-03-24 18:15:49 -04:00
parent 38c039a684
commit a74b63e9cf
10 changed files with 26 additions and 21 deletions

View File

@ -1,4 +1,3 @@
from django.views.generic.simple import direct_to_template
from django.conf.urls.defaults import *
from accounts import views

View File

@ -1,12 +1,12 @@
boto
Django==1.4.5
Django
django-annoying
django-bcrypt
django-debug-toolbar
django-extensions
django-markdown-deux
django-pagination
django-tastypie==0.9.12
django-tastypie
django-taggit
django-templatetag-sugar
fabric

View File

@ -42,6 +42,7 @@ USE_L10N = True
# the operating system. On a Windows environment, this must be set to the same
# as your system time zone
TIME_ZONE = 'America/New_York'
USE_TZ = True
# Language code for the Django installation. All choices can be found here:
# http://www.i18nguy.com/unicode/language-identifiers.html

View File

@ -5,9 +5,9 @@
{% block body-class %}{{ block.super }} static login{% endblock %}
{% block content %}
<form class="form-horizontal static-box" method="post" action="{% url django.contrib.auth.views.login %}">
<form class="form-horizontal static-box" method="post" action="{% url 'django.contrib.auth.views.login' %}">
<div class="alert alert-info">
<strong>Notice:</strong> OpenID is no longer supported. You can <a href="{% url auth_password_reset %}">reset your password here</a>.
<strong>Notice:</strong> OpenID is no longer supported. You can <a href="{% url 'auth_password_reset' %}">reset your password here</a>.
</div>
{% if request.GET.activationcomplete %}
<div class="alert alert-success">
@ -55,7 +55,7 @@
</div>
<div class="form-actions group">
<a class="btn pull-right" href="/signup/">Sign up</a>
<a class="btn pull-right" href="{% url auth_password_reset %}">Reset password</a>
<a class="btn pull-right" href="{% url 'auth_password_reset' %}">Reset password</a>
<button class="btn btn-primary" type="submit">Log in</button>
</div>
</fieldset>

View File

@ -7,7 +7,7 @@
{% block content %}
<div class="static-box">
<div class="alert alert-info alert-alone">
Successfully logged out. <a href="{% url auth_login %}">Log in</a> again?
Successfully logged out. <a href="{% url 'auth_login' %}">Log in</a> again?
</div>
</div>
{% endblock %}

View File

@ -1,3 +1,3 @@
Reset your Snipt password here: {{ protocol }}://{{ domain }}{% url auth_password_reset_confirm uid token %}
Reset your Snipt password here: {{ protocol }}://{{ domain }}{% url 'auth_password_reset_confirm' uid token %}
(btw, your username is "{{ user }}")

19
urls.py
View File

@ -1,7 +1,7 @@
from views import (homepage, lexers, pro_signup, sitemap, tags, pro_signup_complete)
from django.conf.urls.defaults import include, patterns, url
from django.views.generic.simple import direct_to_template
from utils.forms import SniptRegistrationForm
from utils.views import SniptRegistrationView
from django.views.generic import TemplateView
from django.http import HttpResponseRedirect
from django.contrib import admin
from snipts.views import search
@ -31,15 +31,15 @@ urlpatterns = patterns('',
url(r'^admin/', include(admin.site.urls)),
url(r'^404/$', direct_to_template, {'template': '404.html'}),
url(r'^500/$', direct_to_template, {'template': '500.html'}),
url(r'^404/$', TemplateView.as_view(template_name='404.html')),
url(r'^500/$', TemplateView.as_view(template_name='500.html')),
url(r'^robots.txt$', direct_to_template, {'template': 'robots.txt'}),
url(r'^humans.txt$', direct_to_template, {'template': 'humans.txt'}),
url(r'^robots.txt$', TemplateView.as_view(template_name='robots.txt')),
url(r'^humans.txt$', TemplateView.as_view(template_name='humans.txt')),
url(r'^sitemap.xml$', sitemap),
url(r'^tags/$', tags),
url(r'^pro/$', direct_to_template, {'template': 'pro.html'}),
url(r'^pro/$', TemplateView.as_view(template_name='pro.html')),
url(r'^pro/signup/$', pro_signup),
url(r'^pro/signup/complete/$', pro_signup_complete),
@ -54,10 +54,7 @@ urlpatterns = patterns('',
url(r'^register/$', lambda x: HttpResponseRedirect('/signup/')),
url(r'^signup/$',
'registration.views.register', {
'backend': 'registration.backends.default.DefaultBackend',
'form_class': SniptRegistrationForm,
},
SniptRegistrationView.as_view(),
name='registration_register'),
url(r'', include('registration.backends.default.urls')),

View File

@ -7,7 +7,7 @@ from django import forms
class SniptRegistrationForm(RegistrationForm):
"""
Subclass of ``RegistrationForm`` which enforces uniqueness of
email addresses.
email addresses and further restricts usernames.
"""
def clean_username(self):

View File

View File

@ -1 +1,9 @@
# Create your views here.
from registration.backends.default.views import RegistrationView
from utils.forms import SniptRegistrationForm
class SniptRegistrationView(RegistrationView):
"""
Custom registration view that uses our custom form.
"""
form_class = SniptRegistrationForm