[django-1.7] Monkey patch default Django user model for Django 1.7

This commit is contained in:
Benjamin Dauvergne 2015-02-03 12:23:03 +01:00
parent db95cc2335
commit f328f6fe8e
3 changed files with 8 additions and 20 deletions

View File

@ -15,5 +15,7 @@ if django.VERSION >= (1,7):
label = 'authentic2'
def ready(self):
from . import fix_user_model
from . import fix_user_model, compat
fix_user_model.patch_user_model(compat.get_user_model())
fix_user_model.patch_email()
default_app_config = 'authentic2.Authentic2Config'

View File

@ -1,16 +0,0 @@
"""
This file demonstrates writing tests using the unittest module. These will pass
when you run "manage.py test".
Replace this with more appropriate tests for your application.
"""
from django.test import TestCase
class SimpleTest(TestCase):
def test_basic_addition(self):
"""
Tests that 1 + 1 always equals 2.
"""
self.assertEqual(1 + 1, 2)

View File

@ -2,6 +2,7 @@ import time
import re
import urlparse
import django
from django.utils import timezone
from django.utils.http import urlquote
from django.conf import settings
@ -365,6 +366,7 @@ class PasswordReset(models.Model):
def __unicode__(self):
return unicode(self.user)
from . import fix_user_model, compat
fix_user_model.patch_user_model(compat.get_user_model())
fix_user_model.patch_email()
if django.VERSION < (1,7):
from . import fix_user_model, compat
fix_user_model.patch_user_model(compat.get_user_model())
fix_user_model.patch_email()