Add support for custom user models

This commit is contained in:
Cody Goodman 2014-04-22 11:56:09 -05:00
parent 10872ac2eb
commit c6b9f6e8b6
3 changed files with 8 additions and 3 deletions

View file

@ -1,8 +1,9 @@
from django.core.exceptions import ValidationError
from django.db import models
from django.contrib.auth.models import User
from django.contrib.auth import get_user_model
from django.utils.translation import ugettext_lazy as _
User = get_user_model()
class NoActiveTermsOfService(ValidationError):
pass

View file

@ -1,8 +1,10 @@
from django.contrib.auth.models import User
from django.contrib.auth import get_user_model
from django.core.exceptions import ValidationError
from django.test import TestCase
from django.db.models.signals import post_syncdb
User = get_user_model()
from tos.models import TermsOfService, UserAgreement, has_user_agreed_latest_tos
class TestModels(TestCase):

View file

@ -1,11 +1,13 @@
from django.conf import settings
from django.contrib.auth.models import User
from django.contrib.auth import get_user_model
from django.core.exceptions import ValidationError
from django.core.urlresolvers import reverse
from django.test import TestCase
from tos.models import TermsOfService, UserAgreement, has_user_agreed_latest_tos
User = get_user_model()
class TestViews(TestCase):
def setUp(self):