4π
What you request is not so exotic: This is called authority data β you seperate your users to authorities and each authority will have each own data. For instance, you may have a number of departments in an organization β the data of each department can be edited only by members of the same department. I have already written a blog post with a simple approach to that using django:
http://spapas.github.io/2013/11/05/django-authoritiy-data/
To recap the post, I propose just adding an Authority
model for which your User
will have a ForeignKey
(each User
will have a Profile
).
Now, all your Models whose data will belong to specific Authorities
will just contain a ForeignKey
to Authority
. To check for the permissions you could use CBVs β the django admin will only be available to the central Administrators that have access to all the data. I recommend against using the django permissions for authorization of Authority
data. If you want read the post which is much more detailed and ask here any questions.