On Thu, Oct 10, 2013 at 6:00 AM, Burak Emre Kabakcı
<emrekaba...@gmail.com>wrote:

> Thanks for the suggestions.
>
> @Andre Terra I figured out that my solution doesn't work actually. Custom
> managers is not useful in my case because underlying auth system is still
> same, it means it will also use same same session tables, cookies etc.
>
> @Russell Keith-Magee  Sorry, I couldn't understand what you mean in your
> second paragraph. What I'm trying to do is exactly what you're suggesting,
> in the example there is an app called "myapp" and I resolve the url and if
> the request is routed to a view in "myapp" app I change AUTH_USER_MODEL
> setting because AFAIK all applications use a shared settings.py file. If
> there's a way to use different settings for each application, please let me
> know.
> Otherwise if you're suggesting that I should start new project that has
> its manage.py and settings.py I think it would be much more painful.
>

Yes - I mean having two separate projects, with two separate settings
files, etc.

As for being "more painful" -- more painful than what? You haven't proposed
an alternative that will actually work - your middleware-based solution is
fundamentally flawed, for the reasons I described in the first paragraph of
my original response.

It's not like we're talking about a lot of code here. You need to have 2
different settings files. However, those two settings files can share a
common base -- at a bare minimum, it only needs to say:

---
from common_settings import *

AUTH_USER_MODEL = 'project1.User'
---

where common_settings is a file that contains the settings common between
the two projects. Yes, there's some complexity here. But then, you're the
one with a project with two different concepts of User. It doesn't matter
*what* you do, there's going to be complexity.

It's also worth pointing out the other alternatives:

* Use a *single* user model, but have *profiles* to cover the different
"types" of user. If you need a foreign key, use a foreign key to the
*profile*, not the User.

* Write your own authentication backend. Django's auth backend is
pluggable, and isn't bound to auth.User at all.

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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/CAJxq84-Z-%3DQH35_jMHVrs2Ddp9zMBnxLAY_bzFzrptt2a75vKw%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to