Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

有些功能实际上可以用django的方案实现 #53

Open
LeoQuote opened this issue Jan 31, 2018 · 1 comment
Open

有些功能实际上可以用django的方案实现 #53

LeoQuote opened this issue Jan 31, 2018 · 1 comment

Comments

@LeoQuote
Copy link

LeoQuote commented Jan 31, 2018

比如 https://github.com/jly8866/archer/blob/6e2bcef21a7235a436906f2dc952aff3530b07e6/sql/check_login_middleware.py

这里的未登录重定向到/login/ 可以通过 django 的 login_required 实现

from django.contrib.auth.decorators import login_required

@login_required
def my_view(request):

https://docs.djangoproject.com/en/1.8/topics/auth/default/#django.contrib.auth.decorators.login_required

不过这个要用的话就需要用上django 自带的一些认证系统, 这里的用户系统可能会需要一些扩充

角色这块可以用外键的方式扩充, 放在一个Profile table里,然后对应的 view可以使用 django的检验修饰器

等我搭好了会再提一个pull request

@jly8866
Copy link
Owner

jly8866 commented Feb 1, 2018

非常好的建议!辛苦PR,然后发PR的url到群里@七月流火 ,review过后即可merge

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants