2014-09-30 109 views
1

我知道Django,并且一直在试验可以包含的管理页面。允许用户只更改自己的密码/详细信息

我可以看到超级用户如何为某些页面授予其他用户的权限,例如,The Django Book教你如何让用户只能编辑作者,而不是添加他们。但是,我无法让用户能够更改自己的详细信息,但不是全部用户的详细信息。是

权限列表中的选项如下:

admin | log entry | Can add log entry 
admin | log entry | Can change log entry 
admin | log entry | Can delete log entry 
auth | group | Can add group 
auth | group | Can change group 
auth | group | Can delete group 
auth | permission | Can add permission</option> 
auth | permission | Can change permission 
auth | permission | Can delete permission 
auth | user | Can add user 
auth | user | Can change user 
auth | user | Can delete user 
books | author | Can add author 
books | author | Can change author 
books | author | Can delete author 
books | book | Can add book 
books | book | Can change book 
books | book | Can delete book 
books | publisher | Can add publisher 
books | publisher | Can change publisher 
books | publisher | Can delete publisher 
contenttypes | content type | Can add content type 
contenttypes | content type | Can change content type 
contenttypes | content type | Can delete content type 
sessions | session | Can add session 
sessions | session | Can change session 
sessions | session | Can delete session 

回答

1

Django管理是不适合普通用户。如果他们有管理员权限,他们可以在/admin/password_change/更改自己的密码。如果他们不是管理员,则必须写下自己的观点,让他们更改密码。确保永远不要做user.password = new_password,但始终使用user.set_password(new_password),以便它得到适当的散列。

+0

噢,我现在看到屏幕右上角的“更改密码”链接。非常感谢。 – Jon 2014-09-30 13:27:50