摘要: 接口如何使用 阅读全文
posted @ 2019-11-25 22:09 cheerxiong 阅读(195) 评论(0) 推荐(0) 编辑
摘要: ```python- 身份认证from rest_framework.authentication import BaseAuthentication- 导入自定义算法解析tokenfrom utils.TokenIssue import Token_Issueclass NewBaseAuthentication(BaseAuthentication): def authenticate(... 阅读全文
posted @ 2019-11-25 21:59 cheerxiong 阅读(325) 评论(0) 推荐(0) 编辑
摘要: ```python from rest_framework.permissions import BasePermission class CustomPermission(BasePermission): def has_permission(self, request, view): - 权限模块工作原理 1)继承BasePermission类,重写has_permission方法 2)权限规 阅读全文
posted @ 2019-11-25 21:50 cheerxiong 阅读(235) 评论(0) 推荐(0) 编辑
摘要: ```python from django.contrib import admin from . import models - admin注册自定义User表:密文操作密码 from django.contrib.auth.admin import UserAdmin as AuthUserAdmin class UserAdmin(AuthUserAdmin): add_fieldsets 阅读全文
posted @ 2019-11-25 21:49 cheerxiong 阅读(352) 评论(0) 推荐(0) 编辑
摘要: ```python from rest_framework.response import Response # 二次封装Response class APIResponse(Response): def __init__(self, http_status=0, msg='ok', results=None, status=None, template_name=None, headers=No 阅读全文
posted @ 2019-11-25 20:40 cheerxiong 阅读(321) 评论(0) 推荐(0) 编辑
摘要: 重写 settings中的配置 阅读全文
posted @ 2019-11-25 20:39 cheerxiong 阅读(241) 评论(0) 推荐(0) 编辑