随笔分类 - drf
摘要:路由 urlpatterns = [ path('order/', views.OrderView.as_view()), ] 视图关系 class View(object): @classonlymethod def as_view(cls, **initkwargs): def view(req
阅读全文
摘要:报错 Model class django.contrib.contenttypes.models.ContentType doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS. 原因
阅读全文
摘要:django的request对象 request.method request.GET request.POST request.body request.FILES drf中的request参数,又一层封装 request._request.GET request._request.POST re
阅读全文
摘要:路由 urlpatterns = [ path('login/', views.LoginView.as_view()), path('login2/', views.login2), ] 视图 from django.views import View from django.http impor
阅读全文
摘要:安装 pip install djangorestframework 注册 INSTALLED_APPS = [ "rest_framework", ] 配置路由 urlpatterns = [ path('auth/', views.auth), path('login2/', views.log
阅读全文
摘要:django 后端逻辑 def transaction_add(request, pk): res_code = ResCode() if request.method == 'POST': form = TransactionForm(data=request.POST) if not form.
阅读全文