在最新的Django2.1中,views.py中采用的地址映射方式发生了变化,通过一个加法运算我们来看一看. 方法一:在视图views.py中定义视图逻辑,求解两个数的加法运算:c = a + b,定义一个add()函数 from django.shortcuts import render from django.http import HttpResponse from blog import models # 计算求和,网址示例:http://127.0.0.1:8000/add/?a=2
Generic editing views¶ The following views are described on this page and provide a foundation for editing content: django.views.generic.edit.FormView django.views.generic.edit.CreateView django.views.generic.edit.UpdateView django.views.generic.edit