摘要: ```from django.conf.urls import urlfrom django.views.static import servefrom project01.settings import MEDIA_ROOT from . import views urlpatterns = [ url(r'^media/(?P.*)$', serve, {"document_root",... 阅读全文
posted @ 2019-12-30 20:15 YajunRan 阅读(120) 评论(0) 推荐(0) 编辑
摘要: ``` from django.db import models # 汽车表、汽车商家表、赞助商表、赞助商详情表 class BaseModel(models.Model): is_delete = models.BooleanField(default=False) createdTime = models.DateTimeField(auto_now_add=True) class Meta: 阅读全文
posted @ 2019-12-30 11:55 YajunRan 阅读(84) 评论(0) 推荐(0) 编辑
摘要: ``` from rest_framework import serializers from . import models class CarModelSerializer(serializers.ModelSerializer): re_brand = serializers.CharField(write_only=True) class Meta: model = models.Car 阅读全文
posted @ 2019-12-30 11:53 YajunRan 阅读(68) 评论(0) 推荐(0) 编辑
摘要: Serializer序列化(了解) 视图类 序列化类 Serializer反序列化(了解) 视图类 序列化类 阅读全文
posted @ 2019-12-30 09:34 YajunRan 阅读(211) 评论(0) 推荐(0) 编辑