使用django表单要容易得多,但是它们不如使用bootstrap创建的表单好看(我使用bootstrap作为前端),我的问题是:
有没有办法给我的django表单赋予风格,让它像这样:
目前我正在使用django表单,并包含一些要定制的小部件,但我认为我仅限于控制表单,以下是我的代码:
class societyForm(forms.ModelForm):
class Meta:
model = sociedad
fields = '__all__'
widgets = {
'name': forms.TextInput(attrs={'class': 'form-control'}),
'RUC': forms.TextInput(attrs={'class': 'form-control'}),
'NIT': forms.TextInput(attrs={'class': 'form-control'}),
'resident_agent': forms.TextInput(attrs={'class': 'form-control'}),
'president': forms.TextInput(attrs={'class': 'form-control'}),
'vicepresident': forms.TextInput(attrs={'class': 'form-control'}),
'secretary': forms.TextInput(attrs={'class': 'form-control'}),
'incorporation_date': forms.TextInput(attrs={'class': 'form-control'}),
'expiration': forms.TextInput(attrs={'class': 'form-control'}),
'contact': forms.TextInput(attrs={'class': 'form-control'}),
'email': forms.TextInput(attrs={'class': 'form-control'}),
'phone': forms.TextInput(attrs={'class': 'form-control'}),
'status': forms.TextInput(attrs={'class': 'form-control'}),
'comments': forms.TextInput(attrs={'class': 'form-control'}),
}
我们将非常感谢您的想法、建议和建议。
发布于 2021-07-05 11:06:49
https://stackoverflow.com/questions/68250124
复制相似问题