摘要:        
原权限判断代码 def check_permissions(self, request): """ Check if the request should be permitted. Raises an appropriate exception if the request is not perm    阅读全文
posted @ 2022-10-01 18:56
Sherwin_szw
阅读(23)
评论(0)
推荐(0)
        
            
        
        
摘要:        
组件类(返回True为通过) from rest_framework.permissions import BasePermission class DemoPermission(BasePermission): # 自定义失败的返回信息 message = {"status": False, 'c    阅读全文
posted @ 2022-10-01 16:47
Sherwin_szw
阅读(22)
评论(0)
推荐(0)
        
            
        
        
摘要:        
建表 from django.db import models class UserInfo(models.Model): username = models.CharField(verbose_name='用户名', max_length=32) password = models.CharFie    阅读全文
posted @ 2022-10-01 10:42
Sherwin_szw
阅读(39)
评论(0)
推荐(0)
        
            
        
        
摘要:        
class BaseAuthentication: """ All authentication classes should extend BaseAuthentication. """ def authenticate(self, request): """ 如果子类继承BaseAuthenti    阅读全文
posted @ 2022-10-01 08:35
Sherwin_szw
阅读(30)
评论(0)
推荐(0)
        
            
        
        
摘要:        
现象 # 兜底认证,直接失败 class NoAuthentication(BaseAuthentication): def authenticate(self, request): raise AuthenticationFailed('认证失败') class AuthenticationFai    阅读全文
posted @ 2022-10-01 08:29
Sherwin_szw
阅读(64)
评论(0)
推荐(0)
        
 
                    
                
 
         浙公网安备 33010602011771号
浙公网安备 33010602011771号