I am trying to make all of the fields in my Django form have the same size to look tidy. I have text input, drop down and text area. I am creating the form using the Ticket
model so I am not defining the form fields explicitly. I was able to resize the text input, but what is the attribute in a drop-down field that controls the width? Note that the choices in the drop-down are basically foreign keys from another table that are defined in the model.
class NewTicket(forms.ModelForm):
class Meta:
model=Ticket
fields = ('subject','business','project','description')
widgets={
'subject': forms.TextInput(attrs={'size': '20px'}),
'business': forms.Select(attrs={'size': '20px'}) #this line does not work
}
I know you said no CSS but is this an option?
class NewTicket(forms.ModelForm):
class Meta:
model=Ticket
fields = ('subject','business','project','description')
widgets={
'subject': forms.TextInput(attrs={'style': 'width:20px'}),
'business': forms.Select(attrs={'style': 'width:20px'})
}