On Thu, Aug 20, 2009 at 04:54, Andrew Fong<fongand...@gmail.com> wrote: > The real problem is all of the code and third-party contrib that > expects the User model to live at django.contrib.auth.models. Ideally, > all of these apps should be rewritten to expect not the actual User > model but any model that implements a User interface. More broadly > speaking, if your third-party app relies on an external app, this > reliance should be contained within some variable in the settings > module (or equivalent) that other Django users can easily alter as > they see fit. > > For example, your settings.py would do this by default: > > MY_APP_USER = 'auth.User' > > And you would alter your app code from this: > > user = models.ForeignKey(User) > > to this: > > user = models.ForeignKey(settings.MY_APP_USER)
I do something like this for my apps meant to be third-party, but I use a function get_user_model() to check the setting (if not set it uses auth.User), then run User = get_user_model() instead of from blbl import user in models.py and thus the models may look "normal" and need not import settings at all: user = models.ForeignKey(User) The only fields I expect to find in a user-model is passwd and username, though the absolute minimal user-model possible is of course just a primary key for other tables to link to. HM --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django developers" group. 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 -~----------~----~----~----~------~----~------~--~---