Permalink
Browse files

Added Django 1.5 compatibility

  • Loading branch information...
1 parent aab1901 commit 4bc0280abc5a6836026ba017c8f9b3f9eab3f6e2 @flashingpumpkin committed Jan 16, 2013
Showing with 38 additions and 26 deletions.
  1. 0 socialregistration/compat/__init__.py
  2. +4 −0 socialregistration/compat/urls.py
  3. +2 −1 socialregistration/contrib/facebook/templates/socialregistration/facebook/facebook_button.html
  4. +1 −1 socialregistration/contrib/facebook/urls.py
  5. +2 −1 socialregistration/contrib/foursquare/templates/socialregistration/foursquare/foursquare_button.html
  6. +1 −1 socialregistration/contrib/foursquare/urls.py
  7. +2 −1 socialregistration/contrib/github/templates/socialregistration/github/github_button.html
  8. +1 −1 socialregistration/contrib/github/urls.py
  9. +2 −1 socialregistration/contrib/instagram/templates/socialregistration/instagram/instagram_button.html
  10. +1 −1 socialregistration/contrib/instagram/urls.py
  11. +2 −1 socialregistration/contrib/linkedin/templates/socialregistration/linkedin/linkedin_button.html
  12. +1 −1 socialregistration/contrib/linkedin/urls.py
  13. +3 −2 socialregistration/contrib/openid/templates/socialregistration/openid/form.html
  14. +1 −1 socialregistration/contrib/openid/urls.py
  15. +1 −1 socialregistration/contrib/tumblr/models.py
  16. +2 −1 socialregistration/contrib/tumblr/templates/socialregistration/tumblr/tumblr_button.html
  17. +1 −1 socialregistration/contrib/tumblr/urls.py
  18. +2 −1 socialregistration/contrib/twitter/templates/socialregistration/twitter/twitter_button.html
  19. +1 −2 socialregistration/contrib/twitter/urls.py
  20. +1 −1 socialregistration/tests.py
  21. +1 −1 socialregistration/urls.py
  22. +3 −2 tests/templates/index.html
  23. +1 −0 tests/templates/socialregistration/openid_form.html
  24. +2 −3 tests/urls.py
No changes.
@@ -0,0 +1,4 @@
+try:
+ from django.conf.urls import patterns, url, include
+except ImportError: # django 1.3
+ from django.conf.urls.defaults import patterns, url, include
@@ -1,4 +1,5 @@
-<form class="connect-button" name="login" method="post" action="{% url socialregistration:facebook:redirect %}">
+{% load url from future %}
+<form class="connect-button" name="login" method="post" action="{% url 'socialregistration:facebook:redirect' %}">
{% csrf_token %}
{% if next %}
<input type="hidden" name="next" value="{{ next }}" />
@@ -1,5 +1,5 @@
from django.conf import settings
-from django.conf.urls.defaults import *
+from socialregistration.compat.urls import *
from socialregistration.contrib.facebook.views import FacebookSetup, \
FacebookRedirect, FacebookCallback
@@ -1,4 +1,5 @@
-<form action="{% url socialregistration:foursquare:redirect %}" method="post">
+{% load url from future %}
+<form action="{% url 'socialregistration:foursquare:redirect' %}" method="post">
{% csrf_token %}
{% if next %}
<input type="hidden" name="next" value="{{ next }}" />
@@ -1,5 +1,5 @@
from django.conf import settings
-from django.conf.urls.defaults import *
+from socialregistration.compat.urls import *
from socialregistration.contrib.foursquare.views import FoursquareRedirect, \
FoursquareCallback, FoursquareSetup
@@ -1,4 +1,5 @@
-<form action="{% url socialregistration:github:redirect %}" method="post">
+{% load url from future %}
+<form action="{% url 'socialregistration:github:redirect' %}" method="post">
{% csrf_token %}
{% if next %}
<input type="hidden" name="next" value="{{ next }}" />
@@ -1,5 +1,5 @@
from django.conf import settings
-from django.conf.urls.defaults import *
+from socialregistration.compat.urls import *
from socialregistration.contrib.github.views import GithubRedirect, \
GithubCallback, GithubSetup
@@ -1,4 +1,5 @@
-<form action="{% url socialregistration:instagram:redirect %}" method="post">
+{% load url from future %}
+<form action="{% url 'socialregistration:instagram:redirect' %}" method="post">
{% csrf_token %}
{% if next %}
<input type="hidden" name="next" value="{{ next }}" />
@@ -1,5 +1,5 @@
from django.conf import settings
-from django.conf.urls.defaults import *
+from socialregistration.compat.urls import *
from socialregistration.contrib.instagram.views import InstagramRedirect, \
InstagramCallback, InstagramSetup
@@ -1,4 +1,5 @@
-<form class="connect-button" name="login" method="post" action="{% url socialregistration:linkedin:redirect %}">
+{% load url from future %}
+<form class="connect-button" name="login" method="post" action="{% url 'socialregistration:linkedin:redirect' %}">
{% csrf_token %}
{% if next %}
<input type="hidden" name="next" value="{{ next }}" />
@@ -1,5 +1,5 @@
from django.conf import settings
-from django.conf.urls.defaults import *
+from socialregistration.compat.urls import *
from socialregistration.contrib.linkedin.views import LinkedInRedirect, \
LinkedInCallback, LinkedInSetup
@@ -1,4 +1,5 @@
-<form action="{% url socialregistration:openid:redirect %}" method="post">
+{% load url from future %}
+<form action="{% url 'socialregistration:openid:redirect' %}" method="post">
{% csrf_token %}
{% if provider %}
@@ -13,4 +14,4 @@
<input type="submit" value="Connect with OpenID" />
{% endif %}
-</form>
+</form>
@@ -1,5 +1,5 @@
from django.conf import settings
-from django.conf.urls.defaults import *
+from socialregistration.compat.urls import *
from socialregistration.contrib.openid.views import OpenIDRedirect, \
OpenIDCallback, OpenIDSetup
@@ -11,7 +11,7 @@ class TumblrProfile(models.Model):
def __unicode__(self):
try:
- return u'%s: %s' % (self.user, self.tumblr_name)
+ return u'%s: %s' % (self.user, self.tumblr)
except User.DoesNotExist:
return u'None'
@@ -1,4 +1,5 @@
-<form class="connect-button" name="login" method="post" action="{% url socialregistration:tumblr:redirect %}">
+{% load url from future %}
+<form class="connect-button" name="login" method="post" action="{% url 'socialregistration:tumblr:redirect' %}">
{% csrf_token %}
{% if next %}
<input type="hidden" name="next" value="{{ next }}" />
@@ -1,5 +1,5 @@
from django.conf import settings
-from django.conf.urls.defaults import *
+from socialregistration.compat.urls import *
from socialregistration.contrib.tumblr.views import TumblrRedirect, \
TumblrCallback, TumblrSetup
@@ -1,4 +1,5 @@
-<form class="connect-button" name="login" method="post" action="{% url socialregistration:twitter:redirect %}">
+{% load url from future %}
+<form class="connect-button" name="login" method="post" action="{% url 'socialregistration:twitter:redirect' %}">
{% csrf_token %}
{% if next %}
<input type="hidden" name="next" value="{{ next }}" />
@@ -1,6 +1,5 @@
-
from django.conf import settings
-from django.conf.urls.defaults import *
+from socialregistration.compat.urls import *
from socialregistration.contrib.twitter.views import TwitterRedirect, \
TwitterCallback, TwitterSetup
@@ -22,7 +22,7 @@ def get_tag(self):
def test_tag_renders_correctly(self):
load, button = self.get_tag()
-
+
tpl = """{%% load %s %%}{%% %s %%}""" % (load, button)
self.assertTrue('form' in template.Template(tpl).render(template.Context({'request': None})))
@@ -1,5 +1,5 @@
from django.conf import settings
-from django.conf.urls.defaults import *
+from socialregistration.compat.urls import *
from socialregistration.views import Logout, Setup
urlpatterns = patterns('',)
@@ -1,5 +1,6 @@
<html><head><title>Socialregistration example</title></head>
<body>
+{% load url from future %}
{% if not request.user.is_authenticated %}
<h1>django-socialregistration login</h2>
@@ -18,7 +19,7 @@
<li>{% openid_form %}</li>
<li>{% instagram_button %}</li>
<li>
- <form action="{% url socialregistration:openid:redirect %}" method="post">
+ <form action="{% url 'socialregistration:openid:redirect' %}" method="post">
{% csrf_token %}
<input type="hidden" name="openid_provider" value="https://www.google.com/accounts/o8/id" />
<input type="submit" value="Sign in with Google OpenID" />
@@ -40,7 +41,7 @@
</ol>
{% if request.user.is_authenticated %}
- <a href="{% url socialregistration:logout %}">Logout</a>
+ <a href="{% url 'socialregistration:logout' %}">Logout</a>
{% endif %}
<p><a href="https://github.com/flashingpumpkin/django-socialregistration">Code on Github</a></p>
@@ -1,3 +1,4 @@
+{% load url from future %}
<form action="{% url openid_redirect %}" method="GET">
<input type="text" name="openid_provider" />
<input type="submit" value="Connect with OpenID" />
View
@@ -1,12 +1,11 @@
-from django.conf.urls.defaults import patterns, include, url
+from socialregistration.compat.urls import *
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
url(r'^admin/', include(admin.site.urls)),
- url(r'^social/', include('socialregistration.urls',
- namespace='socialregistration')),
+ url(r'^social/', include('socialregistration.urls', namespace='socialregistration')),
url(r'^$', 'tests.app.views.index', name='index'),
)

0 comments on commit 4bc0280

Please sign in to comment.