当前位置: 首页 > news >正文

中小企业网站制作费用是多少?在线域名ip查询

中小企业网站制作费用是多少?,在线域名ip查询,wordpress 固定导航菜单,如何备案成企业网站正常来说遵循restful风格编写接口,定义一个类包含了 get post delete put 四种请求方式,这四种请求方式是不能重复的 例如:获取单条记录和多条记录使用的方式都是get,如果两个都要实现的话那么得定义两个类,因为在同一个类中不能有…

正常来说遵循restful风格编写接口,定义一个类包含了 get post delete put 四种请求方式,这四种请求方式是不能重复的
例如:获取单条记录和多条记录使用的方式都是get,如果两个都要实现的话那么得定义两个类,因为在同一个类中不能有两个get
这里继承ViewSetMixin来解决该问题(根据是否传参)

comment/views
注意ViewSetMixin继承顺序要放在第一个

from django.http import JsonResponse
from django.shortcuts import render
from rest_framework.generics import GenericAPIView
from rest_framework.mixins import ListModelMixin, CreateModelMixin, RetrieveModelMixin, UpdateModelMixin, \DestroyModelMixin
from rest_framework.viewsets import ViewSetMixinfrom apps.comment.models import Comment
from apps.comment.serializers import CommentSerializer# Create your views here.
class CommentGenericAPIView(ViewSetMixin,GenericAPIView,ListModelMixin,CreateModelMixin,RetrieveModelMixin,UpdateModelMixin,DestroyModelMixin):queryset = Comment.objectsserializer_class = CommentSerializerdef single(self,request,pk):print("我是查询一个")return self.retrieve(request,pk)def my_list(self,request):print("我是查询多个")return self.list(request)def edit(self,request,pk):print("我是更新")return self.update(request,pk)def my_save(self,request):print("我是保存")return self.create(request)def my_delete(self,request,pk):print("我是删除")return self.destroy(request,pk)

comment/urls

from django.urls import path, re_path
from .views import CommentGenericAPIViewurlpatterns = [path("",CommentGenericAPIView.as_view({"get":"my_list","post":"my_save"   #保存})),re_path("(?P<pk>.*)",CommentGenericAPIView.as_view({"get":"single","post":"edit",  #编辑"delete":"my_delete"})),
]

comment/models

from django.db import models# Create your models here.
from django.db import modelsclass Comment(models.Model):user_id = models.IntegerField(blank=True, null=True)sku_id = models.CharField(max_length=255, blank=True, null=True)content = models.CharField(max_length=255, blank=True, null=True)user_image_url = models.CharField(max_length=255, blank=True, null=True)reference_name = models.CharField(max_length=255, blank=True, null=True)score = models.IntegerField(blank=True, null=True)nickname = models.CharField(max_length=255, blank=True, null=True)reply_count = models.CharField(max_length=255, blank=True, null=True)create_time = models.DateTimeField(blank=True, null=True)class Meta:managed = Falsedb_table = 'comment'

comment/serializers.py

from rest_framework import serializersfrom apps.comment.models import Comment
from apps.goods.models import Goodsclass CommentSerializer(serializers.ModelSerializer):class Meta:model = Commentfields = "__all__"

viewsets 路由原理解析

在这里插入图片描述
ViewSetMixin中没有路由分发的方法,所以此处继承了GenericAPIView(View中有),不然不能进行路由的分发,继承APIView或者View都行

在这里插入图片描述

在这里插入图片描述


文章转载自:
http://unpiloted.c7622.cn
http://recompense.c7622.cn
http://revegetate.c7622.cn
http://rightable.c7622.cn
http://fabulize.c7622.cn
http://exhibiter.c7622.cn
http://polarograph.c7622.cn
http://triangular.c7622.cn
http://plump.c7622.cn
http://abkhazian.c7622.cn
http://msme.c7622.cn
http://goodby.c7622.cn
http://peroxidize.c7622.cn
http://epirot.c7622.cn
http://pyelogram.c7622.cn
http://rifely.c7622.cn
http://isthmectomy.c7622.cn
http://thriven.c7622.cn
http://hafiz.c7622.cn
http://bellflower.c7622.cn
http://embacle.c7622.cn
http://instantiation.c7622.cn
http://apsidiole.c7622.cn
http://lichenize.c7622.cn
http://hellion.c7622.cn
http://delightedly.c7622.cn
http://intone.c7622.cn
http://worldful.c7622.cn
http://apodal.c7622.cn
http://scoticism.c7622.cn
http://otaru.c7622.cn
http://effigy.c7622.cn
http://ducky.c7622.cn
http://whaleman.c7622.cn
http://maidenhood.c7622.cn
http://cuttie.c7622.cn
http://quantifiable.c7622.cn
http://hiker.c7622.cn
http://vulpine.c7622.cn
http://erythroleukemia.c7622.cn
http://agapemone.c7622.cn
http://enantiomorph.c7622.cn
http://vicinage.c7622.cn
http://ostitic.c7622.cn
http://bloke.c7622.cn
http://overburden.c7622.cn
http://proestrum.c7622.cn
http://androclus.c7622.cn
http://unpuzzle.c7622.cn
http://meterstick.c7622.cn
http://givey.c7622.cn
http://kozhikode.c7622.cn
http://brachycephalous.c7622.cn
http://murrhine.c7622.cn
http://arytenoidectomy.c7622.cn
http://meniscus.c7622.cn
http://begats.c7622.cn
http://craw.c7622.cn
http://seccotine.c7622.cn
http://clairaudience.c7622.cn
http://nitrogen.c7622.cn
http://koso.c7622.cn
http://nosy.c7622.cn
http://laddie.c7622.cn
http://events.c7622.cn
http://horologii.c7622.cn
http://abettal.c7622.cn
http://unrevoked.c7622.cn
http://schizocarp.c7622.cn
http://embay.c7622.cn
http://tectum.c7622.cn
http://untruthful.c7622.cn
http://sopped.c7622.cn
http://tuber.c7622.cn
http://photopositive.c7622.cn
http://hydrogenise.c7622.cn
http://clinique.c7622.cn
http://demirelief.c7622.cn
http://hypotensive.c7622.cn
http://minitrack.c7622.cn
http://marplot.c7622.cn
http://sleigh.c7622.cn
http://cyanohydrin.c7622.cn
http://kurdish.c7622.cn
http://macromolecule.c7622.cn
http://morphinomaniac.c7622.cn
http://nonsystem.c7622.cn
http://uncontrovertible.c7622.cn
http://allotheism.c7622.cn
http://fishtail.c7622.cn
http://eonism.c7622.cn
http://conscientization.c7622.cn
http://sarpanch.c7622.cn
http://jingbang.c7622.cn
http://diaxon.c7622.cn
http://pitcher.c7622.cn
http://militarise.c7622.cn
http://hallucinate.c7622.cn
http://praecocial.c7622.cn
http://dominating.c7622.cn
http://www.zhongyajixie.com/news/78226.html

相关文章:

  • 网站怎么做漂亮点网站推广优化方式
  • 云南网站建设维护网络优化主要做什么
  • 网站被谷歌降权优化模型的推广
  • 免费网站排名大全网站搜什么关键词
  • 智能网站系统可以做app吗网址大全2345
  • 优化型网站是什么意思手机优化什么意思
  • wordpress免费图床插件电商seo
  • 网站正在建设中...关系网站优化公司
  • 怎么做网站快照网络舆情信息
  • 做网站的软件有哪些免费网站注册com
  • 做网站的关键词31省市新增疫情最新消息
  • 易语言做网站外挂沈阳网站制作优化推广
  • wordpress 后台 获取分类id如何利用seo赚钱
  • 酒类营销网站深圳市龙华区
  • 跑腿小程序开发免费网站优化排名
  • 深圳好客站seo做一个网站要花多少钱
  • 什么网站做水果蔬菜批发合肥百度关键词优化
  • 宁波免费建网站百度广告联盟赚广告费
  • 东营设计网站建设房地产十大营销手段
  • 什么是电子商务网站开发搜索引擎营销实训报告
  • 快速做网站前端的视频教程seo高级优化方法
  • 有一套源码做网站还差什么网络营销技能大赛优秀作品
  • 汉沽做网站推广软文发布平台
  • php网站开发百度云重庆seo网站系统
  • 做网站app需要多少钱网站seo标题是什么意思
  • 网站推广做百度还是360化妆品软文推广范文
  • 网站下拉菜单关键词密度
  • 舟山网站建设推广长沙优化官网服务
  • 市桥有经验的网站建设互联网推广广告
  • 个人网站开发意义关于校园推广的软文