Pull requests

#58 Declined
Repository
mszamot
Branch
default
Repository
ubernostrum
Branch
default

Compatibility with custom user mode in Django 1.5

Author
  1. mszamot
Reviewers
Description

In Django 1.5 one should use django.contrib.auth.get_user_model to get the user model.

  • Learn about pull requests

Comments (5)

  1. Jose Chaso

    Please also note that in file registration/forms.py you can strip the comment from lines 3 to 7, because it wont make sense anymore

    Note that all of these forms assume Django's bundle default User model; since it's not possible for a form to anticipate in advance the needs of custom user models, you will need to write your own forms if you're using a custom model.

  2. allen ling

    What about this issue? 'MyUser' object has no attribute 'email_user'

    Seems that django.contrib.auth.model.User , or my custom User model MyUser, do not have email_user method, should i create it myself?

  3. puterleat

    Actually, just checked and this patch fixes the issue I mentioned:

    --- a/registration/models.py    Mon Jun 17 03:41:47 2013 -0500
    +++ b/registration/models.py    Fri Mar 21 15:27:47 2014 +0000
    @@ -13,6 +13,8 @@
     try:
         from django.contrib.auth import get_user_model
         User = get_user_model()
    +except RuntimeError:
    +    User = settings.AUTH_USER_MODEL
     except ImportError:
         from django.contrib.auth.models import User