1:From组件的简单使用 1创建From: #导入模块 from django import forms from django.forms import fields, widgets # 导入自定制插件 class F1(forms.Form): #自定制插件:widget=widgets.TextInput(attrs={'class': 123})设置属性 user = fields.CharField(min_length=3, max_length=18, widget=widge…
from django.shortcuts import render,HttpResponse from django import forms from django.core.exceptions import ValidationError #校验错误 class UserInfo(forms.Form): username = forms.CharField( label='用户名', required=True, ) password = forms.CharField( label…