随笔分类 -  django-restframework

摘要:rest_framework自带的权限 引入 from rest_framework import permissions permissions.AllowAny 允许所有人访问 permissions.IsAuthenticated 仅允许登录的人员访问 判断条件是request.user an 阅读全文
posted @ 2021-01-02 14:17 xsan 阅读(603) 评论(0) 推荐(0) 编辑
摘要:基础的ViewSet views.py from rest_framework import viewsets from .models import Merchant from .serializers import MerchantSerializer from rest_framework.r 阅读全文
posted @ 2021-01-01 17:44 xsan 阅读(179) 评论(0) 推荐(0) 编辑
摘要:from rest_framework.views import APIView from meituan.models import Merchant from django.http import Http404 from .serializers import MerchantSerializ 阅读全文
posted @ 2021-01-01 16:44 xsan 阅读(123) 评论(0) 推荐(0) 编辑
摘要:from rest_framework.views import APIView from meituan.models import Merchant from django.http import Http404 from .serializers import MerchantSerializ 阅读全文
posted @ 2021-01-01 16:43 xsan 阅读(116) 评论(0) 推荐(0) 编辑
摘要:from rest_framework.views import APIView from meituan.models import Merchant from django.http import Http404 from .serializers import MerchantSerializ 阅读全文
posted @ 2020-12-26 16:54 xsan 阅读(150) 评论(0) 推荐(0) 编辑
摘要:模型序列化 from rest_framework import serializers from meituan.models import Merchant, class MerchantSerializer(serializers.ModelSerializer): class Meta: m 阅读全文
posted @ 2020-12-26 16:39 xsan 阅读(351) 评论(0) 推荐(0) 编辑
摘要:DRF基础的序列化 阅读全文
posted @ 2020-12-26 16:04 xsan 阅读(101) 评论(0) 推荐(0) 编辑