Django身份验证中的两组用户(教师和学生) [英] Two sets of users (teacher and student) in Django authentication

查看:218
本文介绍了Django身份验证中的两组用户(教师和学生)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在构建一个Web应用程序,其中有两组用户(学生和教师)。教师应该能够创建自己的帐户,创建其内容的页面。学生应该能够创建一个帐户来注册该内容。我目前正在使用django-registration来处理注册,但是我想知道什么是处理这两组用户并仍然能够使用Django身份验证框架的最佳方法?我听说过有多个配置文件,但需要一些意见。

I'm building a web application where I have 2 sets of users (students and teachers). Teachers should be able to create their account, create a page of their content. Students should be able to create an account to sign up for this content. I am currently using django-registration to handle registration but I am wondering what's the best way to handle these 2 sets of users and still be able to use the Django authentication framework? I have heard about having multiple profiles but would like some opinions.

谢谢!

推荐答案

您可以使用权限。如果他们是教师,则在他们注册后为其授予内容创建权限。如果他们是学生,则不会获得许可。

You could use permissions. When they sign up if they're a Teacher give them content creation permissions. If they're a student they don't get the permissions.

在用户个人资料中,我只会有一个字段说明他们是哪种类型。除非很多数据不同,否则我不会有两个用户个人资料。

In the user profile I would just have a field that says which type they are. Unless a lot of the data is different I wouldn't have two user profiles.

这篇关于Django身份验证中的两组用户(教师和学生)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆