【文件属性】:
文件名称:python django
文件大小:1KB
文件格式:PY
更新时间:2021-05-26 04:10:11
zip
from django import forms
from student.models import *
class ConcatForm(forms.Form):
tel=forms.CharField(label="电话",max_length=20)
qq =forms.CharField(label="qq号",max_length=50)
# emali=forms.CharField(label="邮箱",max_length=50)
emali=forms.EmailField(label="邮箱")
iswai=forms.BooleanField(label="外籍",initial=True)
roleName=forms.ChoiceField(choices=(("政治家","政治家"),("群众","群众")),widget=forms.RadioSelect())
likes=forms.ChoiceField(label="爱好",choices=(("体育","体育"),("音乐","音乐"),("美术","美术")),widget=forms.CheckboxSelectMultiple())
City=forms.ChoiceField(choices=(("北京","北京"),("河北","河北")))
createTime=forms.DateTimeField(label="注册时间")
img=forms.FileField(label="头像")
class studentForm(forms.ModelForm):
SEX_CHOICES=(
("男","男"),
("女","女"),
)
LIKES_CHOICES=(
("体育","体育"),
("音乐","音乐"),
("美术","美术"),
)
name=forms.CharField(label="姓名")
sex=forms.ChoiceField(label="性别",choices=SEX_CHOICES,widget=forms.RadioSelect)
likes=forms.MultipleChoiceField(label="爱好",choices=LIKES_CHOICES,widget=forms.CheckboxSelectMultiple)
# imgpath=forms.FileField(label="头像")
class Meta:
model=Student
fields='__all__'