dsdshcym / course-pick Goto Github PK
View Code? Open in Web Editor NEWDatabase Midterm Project
Database Midterm Project
您好:
我在用 django 做一个lab面试预约系统,但是关于多用户类型的问题一直没有解决。搜了很长时间,终于找到了您的项目。非常感谢!
有几个小问题:
class Assistant(models.Model):
user = models.OneToOneField(User)
name = models.CharField(max_length=50)
id = models.CharField(max_length=30, primary_key=True)
user_type = 'assistant'
def __str__(self):
return self.name
如果像这样设置的话,整个验证系统仍然采用系统自带的User 对吧?我看到您在 https://www.v2ex.com/t/187480 提到 考虑过 用 groups 来实现。请问 Group 是如何使用呢...? (实在没有找到明确的文档)
如果不用 group,则您是如何实现的呢?
我看到在 https://github.com/dsdshcym/course-pick/blob/master/course_pick/views.py 里,
您使用:
user = request.user
if user.is_authenticated():
try:
if user.student:
return redirect('/courses/student/')
except:
pass
请问 user.student 是 怎么来的呀?
您的回答会对我非常有帮助,谢谢~
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.