On Thu, Sep 19, 2013 at 3:39 AM, Luke Sneeringer <l...@sneeringer.com>wrote:
> I added the authtools approach to the wiki for completion, although I > believe it to be an inferior approach. > > One thing I dislike is having a separate app (e.g. d.c.auth_email) that > has to be installed separately. That feels pretty impure to me. I'm doing a > thought exercise about potential solutions, though, and not exactly coming > up aces. > > The best solution I can currently think of is to have User and EmailUser > which are both models that live in django.contrib.auth. Then, we would have > to add code to our model detection that says that *if* a model is a > subclass of AbstractBaseUser, include it if and only if it is the > AUTH_USER_MODEL. > > I can't decide if that solution is better or worse than the disease. It > makes for a much more attractive set of steps to follow for people who want > to use it, though -- basically, just set AUTH_USER_MODEL to > 'auth.EmailUser', and done. > > My opinion - it's worse than the disease. Option 1 involves a clean auth app that just contains a stub user, and a clean extension app providing an alternative user. You install the extension app, and say you want to use it. Option 2 makes a special case of *one particular* extension user, and makes all the internals of models, forms, views, etc embedded inside an if statement. Option 1 strikes me as Django eating it's own dog food. Option 2 is making the internals of contrib.auth a mess to support one specific use case. Option 1 lets us provide implicit documentation of "this is how you build a pluggable User app". Option 2 means we spend our life making sure we're editing the right code at the right level of indentation. If it isn't clear by now, I see very little to like in Option 2 :-) Yours, Russ Magee %-) -- You received this message because you are subscribed to the Google Groups "Django developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-developers+unsubscr...@googlegroups.com. To post to this group, send email to django-developers@googlegroups.com. Visit this group at http://groups.google.com/group/django-developers. For more options, visit https://groups.google.com/groups/opt_out.