You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
|
from app01 import models
|
|
|
|
|
from django.core.validators import RegexValidator
|
|
|
|
|
from django.core.exceptions import ValidationError
|
|
|
|
|
from django import forms
|
|
|
|
|
from app01.utils.bootstrap import BootStrapModelForm
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class UserModelForm(BootStrapModelForm):
|
|
|
|
|
name = forms.CharField(
|
|
|
|
|
min_length=2,
|
|
|
|
|
label="用户名",
|
|
|
|
|
widget=forms.TextInput(attrs={"class": "form-control"})
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
class Meta:
|
|
|
|
|
model = models.UserInfo
|
|
|
|
|
fields = ["name", "password", "age", 'account', 'create_time', "gender"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class MovieModelForm(BootStrapModelForm):
|
|
|
|
|
class Meta:
|
|
|
|
|
model = models.Movie
|
|
|
|
|
exclude = ['id']
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# 验证:方式2
|
|
|
|
|
|
|
|
|
|
|