我想有两种类型的用户,NormalUsers和ArtistUser,每种用户都有不同的权限:
我已尝试扩展django用户模型,我的代码是:
models.py
body, html {
margin: 0;
padding: 0;
}
video {
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
min-width: 100%;
min-height: 100%;
width: auto;
height: auto;
z-index: 1;
}
}
.text {
z-index: -1;
position: absolute;
background: rgba(0, 0, 0, 0);
}
a {
font-family: Helvetica, Arial;
font-size: 6em;
color: white;
text-align:
}
.image{
position: fixed;
/*element can move on the screen (only screen, not page)*/
left:50%;top:50%;
/*set the top left corner of the element on the center of the screen*/
transform:translate(-50%,-50%);
/*reposition element center with screen center*/
background: rgba(0, 0, 0, 0);
z-index:10000;
/*actually, this number is the count of the elements of page plus 1 :)*/
/*if you need that holds the element top of the others. */
}
有人可以帮我解决这个问题。
提前感谢。
答案 0 :(得分:0)
已解决:
比拥有不同的用户更容易,我将一个用户添加到组中,这取决于角色,然后每个组都具有不同的权限
if data['normal_user'] == True:
normal_user_group = Group.objects.get(name='normal_user')
normal_user_group.user_set.add(user)
if data['artist_user'] == True:
artist_user_group = Group.objects.get(name='artist_user')
artist_user_group.user_set.add(user)