#58 Declined
mszamot mszamot
ubernostrum ubernostrum

Compatibility with custom user mode in Django 1.5

  1. mszamot avatarmszamot

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

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 @@
         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
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.