随笔分类 -  rest framework

摘要:在 rest framework 的 authentication.py 中 BaseAuthentication 是我们自己写认证类要继承的 class BaseAuthentication: """ All authentication classes should extend BaseAut 阅读全文
posted @ 2021-01-14 21:45 Sch01aR#
摘要:实现:用户登录成功后,对应的 token 表创建一条对应登录用户的 token 数据 models.py: from django.db import models class UserInfo(models.Model): user_type_choices = ( (1, "普通用户"), (2 阅读全文
posted @ 2021-01-13 22:02 Sch01aR#
摘要:访问一个继承 rest framework APIView 的 url 解决办法: 在 settings.py 中进行配置 添加上这句话就可以解决 阅读全文
posted @ 2021-01-12 23:59 Sch01aR#
摘要:rest framework 的 APIView 是继承 django 的 View,且有所扩展 代码: from django.shortcuts import render, HttpResponse from rest_framework.views import APIView # 要被视图 阅读全文
posted @ 2021-01-12 23:55 Sch01aR#