1. Django的Form主要具有以下几大功能: 生成HTML标签 验证用户数据(显示错误信息) HTML Form提交保留上次提交的数据 初始化页面显示内容 2. 第一个案例: # 第一步: 创建Form类 from django.forms import Form from django.forms import widgets from django.forms import fields class MyForm(Form): user = fields.CharField( widg…
from django.shortcuts import render,redirect # Create your views here. from .models import * from django import forms from django.forms import widgets from django.forms import ModelForm ''' class BookForm(forms.Form): # 原生form email=forms.EmailField(…