FBV:基于函数视图
CBV:基于类视图
urls.py
url(‘r^add_publisheer/‘,views.AddPublisher.as_view()),
上传文件示例
views.py
from django.views import View
from django.shortcuts import render,HttpResponse
class AddPublisher(View):
def get(self,request):
pass
def post(self,request):
print(request..path_info)#打印一下当前访问的路径
原文地址:https://blog.51cto.com/yht1990/2406545
时间: 2024-10-03 03:43:42