0

I want to let a logged-in and registered user create extra user accounts that he will be the admin of. These accounts will be special "subordinate" accounts that are tied to the user creating them. He should be able to add/modify/delete these accounts kind of like the theory of how a Google apps administrator manages the accounts for his company (you are a regular user, but also create/destroy other users.)

The subordinate accounts cannot create/modify/delete accounts (except change their own password and normal user behavior.) I'm using the django auth model for all of these accounts. What is a good way to access the auth methods to add/modify/delete accounts from my own custom built webpages without using any admin code?

4

1 回答 1

5

首先,您需要扩展您的 User 模型。然后:添加一个表示用户类别的字段 - “下属”或“管理员”。添加一个通过外键引用“admin”用户的字段,以便您可以按用户的“admin”对用户进行分组。如果用户类别为“admin”,则创建检查用户类别并允许创建、编辑、删除“下属”用户帐户的视图。

于 2009-02-27T04:04:39.613 回答