from django import forms
from app_name import models
class class_name(forms.ModelForm)
class Meta:
model = models.Book //默认是所有的都匹配
fields = (‘name‘,‘pub_date‘) //提供要匹配的字段
widget = {
‘name’:forms.TextInput(attrs = {‘class‘:‘form-control‘}) 前端样式
}
时间: 2024-10-03 23:26:37