I have recently being trying to create a project which has several levels of user involved.
(Just an example of an abbreviated and rough schema)
- ME (Super User)
- Client(s)
- Customer(s)
- Survey Collections
- SurveyUser(s)
- Invitee(s)
- Surveys
- Invitee(s) (invitee is a child of both survey and user)
- Questions
- Etc
- SurveyUser(s)
- Client(s)
I would ideally have:
- www.example.com/client/ go to a client interface which you had to be a client to access
- www.example.com/customer/ go to a customer interface which you had to be a customer to access
I have already established that using a customised Django admin interface for all of them is probably not going to be possible (or is it?). I am therefore leaning towards manually creating 'admin' interfaces for each level of user, allowing them to manage their respective roles. What is the best way of having different user types and separate interfaces for each one?
I like the way of inheriting users outlined at: http://scottbarnham.com/blog/2008/08/21/extending-the-django-user-model-with-inheritance/
But am unsure how I would set up different 'admin' areas for different users.
As a side issue that is related, I am also unsure of how to access the custom properties alongside standard user properties and how to edit/save them in the ACTUAL admin interface that I will use.
I would need to authenticate 'Client' users against a client database to check they are clients but somehow also authenticate against the user database which manages authentication, username, password etc.
I am switching from PHP to Python/Django so any advice greatly appreciated to help me along.
Thanks!
The closest I got to this was based on another stackoverflow article here: How to have 2 different admin sites in a Django project?
I ended up creating two entirely separate instances of django.contrib.admin.sites.AdminSite which seemed to work in the end, albeit not ideal.
来源:https://stackoverflow.com/questions/5317670/seperate-admin-interfaces-for-different-user-types-in-django