开发者

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(C开发者_StackOverflow中文版ompany)

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?


hey, maybe you can do something like this


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.


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜