It is great to see this merged, it has been a long time coming. :)

I would like to add backwards compatibility to some apps and I'm looking 
for a recommended technique. Could the following, or a better option, find 
its way into the docs in a section specific to app developers tasked with 
adding support for auth_user_model. Having a recommendation in the docs 
would make pull requests with this feature more likely and easier to handle.


try:
    from django.contrib.auth import get_user_model
    auth_user_model = get_user_model()
except ImportError:
    from django.contrib.auth.models import User
    auth_user_model = User

class SomeModel(models.Model):

    author = models.ForeignKey(auth_user_model)

Because this isn't backwards compatible:
   
class SomeModel(models.Model):

    author = models.ForeignKey(settings.AUTH_USER_MODEL)

best,
Tom


-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-developers/-/xrDV4FTmGkgJ.
To post to this group, send email to django-developers@googlegroups.com.
To unsubscribe from this group, send email to 
django-developers+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en.

Reply via email to