Lots of updates for Django 1.5 support, including url tag fixes, and django-registration upgrades.
parent
38c039a684
commit
a74b63e9cf
|
@ -1,4 +1,3 @@
|
||||||
from django.views.generic.simple import direct_to_template
|
|
||||||
from django.conf.urls.defaults import *
|
from django.conf.urls.defaults import *
|
||||||
|
|
||||||
from accounts import views
|
from accounts import views
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
boto
|
boto
|
||||||
Django==1.4.5
|
Django
|
||||||
django-annoying
|
django-annoying
|
||||||
django-bcrypt
|
django-bcrypt
|
||||||
django-debug-toolbar
|
django-debug-toolbar
|
||||||
django-extensions
|
django-extensions
|
||||||
django-markdown-deux
|
django-markdown-deux
|
||||||
django-pagination
|
django-pagination
|
||||||
django-tastypie==0.9.12
|
django-tastypie
|
||||||
django-taggit
|
django-taggit
|
||||||
django-templatetag-sugar
|
django-templatetag-sugar
|
||||||
fabric
|
fabric
|
||||||
|
|
|
@ -42,6 +42,7 @@ USE_L10N = True
|
||||||
# the operating system. On a Windows environment, this must be set to the same
|
# the operating system. On a Windows environment, this must be set to the same
|
||||||
# as your system time zone
|
# as your system time zone
|
||||||
TIME_ZONE = 'America/New_York'
|
TIME_ZONE = 'America/New_York'
|
||||||
|
USE_TZ = True
|
||||||
|
|
||||||
# Language code for the Django installation. All choices can be found here:
|
# Language code for the Django installation. All choices can be found here:
|
||||||
# http://www.i18nguy.com/unicode/language-identifiers.html
|
# http://www.i18nguy.com/unicode/language-identifiers.html
|
||||||
|
|
|
@ -5,9 +5,9 @@
|
||||||
{% block body-class %}{{ block.super }} static login{% endblock %}
|
{% block body-class %}{{ block.super }} static login{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% 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">
|
<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>
|
</div>
|
||||||
{% if request.GET.activationcomplete %}
|
{% if request.GET.activationcomplete %}
|
||||||
<div class="alert alert-success">
|
<div class="alert alert-success">
|
||||||
|
@ -55,7 +55,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="form-actions group">
|
<div class="form-actions group">
|
||||||
<a class="btn pull-right" href="/signup/">Sign up</a>
|
<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>
|
<button class="btn btn-primary" type="submit">Log in</button>
|
||||||
</div>
|
</div>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<div class="static-box">
|
<div class="static-box">
|
||||||
<div class="alert alert-info alert-alone">
|
<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>
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -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 }}")
|
(btw, your username is "{{ user }}")
|
||||||
|
|
19
urls.py
19
urls.py
|
@ -1,7 +1,7 @@
|
||||||
from views import (homepage, lexers, pro_signup, sitemap, tags, pro_signup_complete)
|
from views import (homepage, lexers, pro_signup, sitemap, tags, pro_signup_complete)
|
||||||
from django.conf.urls.defaults import include, patterns, url
|
from django.conf.urls.defaults import include, patterns, url
|
||||||
from django.views.generic.simple import direct_to_template
|
from utils.views import SniptRegistrationView
|
||||||
from utils.forms import SniptRegistrationForm
|
from django.views.generic import TemplateView
|
||||||
from django.http import HttpResponseRedirect
|
from django.http import HttpResponseRedirect
|
||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
from snipts.views import search
|
from snipts.views import search
|
||||||
|
@ -31,15 +31,15 @@ urlpatterns = patterns('',
|
||||||
|
|
||||||
url(r'^admin/', include(admin.site.urls)),
|
url(r'^admin/', include(admin.site.urls)),
|
||||||
|
|
||||||
url(r'^404/$', direct_to_template, {'template': '404.html'}),
|
url(r'^404/$', TemplateView.as_view(template_name='404.html')),
|
||||||
url(r'^500/$', direct_to_template, {'template': '500.html'}),
|
url(r'^500/$', TemplateView.as_view(template_name='500.html')),
|
||||||
|
|
||||||
url(r'^robots.txt$', direct_to_template, {'template': 'robots.txt'}),
|
url(r'^robots.txt$', TemplateView.as_view(template_name='robots.txt')),
|
||||||
url(r'^humans.txt$', direct_to_template, {'template': 'humans.txt'}),
|
url(r'^humans.txt$', TemplateView.as_view(template_name='humans.txt')),
|
||||||
url(r'^sitemap.xml$', sitemap),
|
url(r'^sitemap.xml$', sitemap),
|
||||||
url(r'^tags/$', tags),
|
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/$', pro_signup),
|
||||||
url(r'^pro/signup/complete/$', pro_signup_complete),
|
url(r'^pro/signup/complete/$', pro_signup_complete),
|
||||||
|
|
||||||
|
@ -54,10 +54,7 @@ urlpatterns = patterns('',
|
||||||
|
|
||||||
url(r'^register/$', lambda x: HttpResponseRedirect('/signup/')),
|
url(r'^register/$', lambda x: HttpResponseRedirect('/signup/')),
|
||||||
url(r'^signup/$',
|
url(r'^signup/$',
|
||||||
'registration.views.register', {
|
SniptRegistrationView.as_view(),
|
||||||
'backend': 'registration.backends.default.DefaultBackend',
|
|
||||||
'form_class': SniptRegistrationForm,
|
|
||||||
},
|
|
||||||
name='registration_register'),
|
name='registration_register'),
|
||||||
url(r'', include('registration.backends.default.urls')),
|
url(r'', include('registration.backends.default.urls')),
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ from django import forms
|
||||||
class SniptRegistrationForm(RegistrationForm):
|
class SniptRegistrationForm(RegistrationForm):
|
||||||
"""
|
"""
|
||||||
Subclass of ``RegistrationForm`` which enforces uniqueness of
|
Subclass of ``RegistrationForm`` which enforces uniqueness of
|
||||||
email addresses.
|
email addresses and further restricts usernames.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
def clean_username(self):
|
def clean_username(self):
|
||||||
|
|
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue