Skip to content

Commit

Permalink
Version 1.2.2
Browse files Browse the repository at this point in the history
* Fix for ``get_user_model``
* Fix missing URL encoding of QueryDict
* Documentation update for Django 1.10 deprecations
  • Loading branch information
Liz4v committed Jul 23, 2016
2 parents 7be6206 + 5aca1c5 commit 3beb502
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 14 deletions.
2 changes: 1 addition & 1 deletion django_oneall/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# -*- coding: utf-8 -*-
__version__ = '1.2'
__version__ = '1.2.2'
2 changes: 1 addition & 1 deletion django_oneall/management/commands/emaillogin.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def handle(self, email, send, **options):
self.stderr.write("Failed. E-mail is mandatory.")
return
query_string = EmailTokenAuthBackend().issue(email)
msg = "Complete login with: %s?%s" % (reverse('oneall-login'), query_string)
msg = "Complete login with: %s?%s" % (reverse('oneall-login'), query_string.urlencode())
self.stdout.write(msg)
if send:
mail = EmailMessage()
Expand Down
5 changes: 2 additions & 3 deletions django_oneall/management/commands/setsuperuser.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
# -*- coding: utf-8 -*-
from uuid import UUID

from django.contrib.auth import get_user_model
from django.core.management.base import BaseCommand
from django.core.urlresolvers import reverse

from ...auth import EmailTokenAuthBackend
from ...models import SocialUserCache
from ...models import SocialUserCache, get_user_model


class Command(BaseCommand):
Expand All @@ -27,7 +26,7 @@ def _extract_user(self, user):
pass
if '@' in user:
auth = EmailTokenAuthBackend()
self.stdout.write("Login with: %s?%s" % (reverse('oneall-login'), auth.issue(user)))
self.stdout.write("Login with: %s?%s" % (reverse('oneall-login'), auth.issue(user).urlencode()))
return auth.login.produce_user()
self.stdout.write("User <%s> not found." % user)

Expand Down
8 changes: 6 additions & 2 deletions django_oneall/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,21 @@
from re import match, sub
from uuid import uuid4

from django.conf import settings as django_settings
from django.db import models
from django.db.transaction import atomic
from django.utils.timezone import now
from django.conf import settings as django_settings
from django.contrib.auth import get_user_model
from pyoneall.base import OADict

from .app import settings

log = getLogger(__name__)

try:
from django.contrib.auth import get_user_model
except ImportError:
from django.db.models import get_user_model


class SocialUserCache(models.Model):
"""
Expand Down
3 changes: 1 addition & 2 deletions django_oneall/templatetags/oneall.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
# -*- coding: utf-8 -*-
from json import dumps

from django.db.models import get_user_model
from django.template import Library
from django.utils.html import escape
from django.utils.safestring import mark_safe

from ..app import settings
from ..models import SocialUserCache
from ..models import SocialUserCache, get_user_model

register = Library()

Expand Down
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
# The short X.Y version.
version = '1.2'
# The full version, including alpha/beta/rc tags.
release = '1.2'
release = '1.2.2'

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down
10 changes: 7 additions & 3 deletions docs/settings.rst
Original file line number Diff line number Diff line change
Expand Up @@ -80,14 +80,18 @@ After that, if you're updating from 0.1.4 or older, the legacy table ``oneall_ca
^^^^^^^^^^^
Add the following URL pattern to your ``urlpatterns`` in your global ``urls.py``::

url(r'^accounts/', include('django_oneall.urls')),
import django_oneall.urls

url(r'^accounts/', include(django_oneall.urls)),

Using this Django App in ``/accounts/`` will work as a drop-in replacement to ``django.contrib.auth``.

However, if you're using ``django.contrib.admin``, it implements its own login screen, which conflicts with OneAll's.
You then need to override its login screen like so::
You then need to **also** override its login screen like so::

import django_oneall.views

url(r'^admin/login', 'django_oneall.views.oa_login'),
url(r'^admin/login', django_oneall.views.oa_login),
url(r'^admin/', include(admin.site.urls)),

Super User
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
README = open(join(dirname(__file__), 'README.rst')).read()
setup(
name='django-oneall',
version='1.2',
version='1.2.2',
packages=find_packages(),
package_data={
'django_oneall/templates/oneall': [
Expand Down

0 comments on commit 3beb502

Please sign in to comment.