2021
01-17
01-17
使用Django的JsonResponse返回数据的实现
urls.pyfromdjango.conf.urlsimporturlfrom.importviewsurlpatterns=[url(r'^show/',views.show_view,name='show')]在views.py中创建show_view函数fromdjango.httpimportHttpResponsefromdjango.shortcutsimportrenderfrom.modelsimport*fromdjango.core.paginatorimportPaginator,PageNotAnInteger,EmptyPagefromdjango.httpimportJsonResponsedefshow_view(request):#获取当前页码数num=re...
继续阅读 >