标签:cut html path from class turn style 视图 col
1、基于类的视图(推荐)
from django.shortcuts import render,HttpResponse from django.views import View # Create your views here. class TestView(View): def get(self, request): return render(request, "test.html") def post(self, request): return HttpResponse("Post")
path(‘test/‘, views.TestView.as_view()),
2、方法
http_method_names = [‘get‘, ‘post‘, ‘put‘, ‘patch‘, ‘delete‘, ‘head‘, ‘options‘, ‘trace‘]
‘get‘, ‘post‘, ‘put‘, ‘patch‘, ‘delete‘最常用
put和patch都是修改数据时使用,区别 put全部修改 patch部分修改
标签:cut html path from class turn style 视图 col
原文地址:https://www.cnblogs.com/wt7018/p/11450816.html