JPG
JPG

Reputation: 13

django admin site - filtering available objects for user

I have models that belong to some 'group' (Company class). I want to add users, who will also belong to a one group and should be able to edit/manage/add objects with membership in associated group.

something like:

class Company()

class Something()
  company = ForeignKey(Company)

user Microsoft_admin
  company = ForeignKey(Company)

and this user should only see and edit objects belonging to associated Company in the Admin Interface.

How to acomplish that?

Upvotes: 1

Views: 2184

Answers (3)

Danny W. Adair
Danny W. Adair

Reputation: 12978

I'd say this has been satisfyingly answered in How can I implement a global, implicit filter in Django admin?

Upvotes: 0

Anthony Briggs
Anthony Briggs

Reputation: 3465

There are a few different ways to do it. The magic words that you're looking for are "row level permissions". Search for that and "Django" and you should find what you're looking for.

Beyond a certain point though, it's easier to roll your own views. It all depends on your use case, and what exactly you're trying to achieve.

Upvotes: 0

eos87
eos87

Reputation: 9363

hey, maybe you can do something like this

Upvotes: 3

Related Questions