What is the best way to change text field size in Grappelli?
Standard text field with vTextField class is 758px width. I looks strange when used for phone number field.
I have figured out that one possibility is inject style attribute into form meta.
class CompanyForm(ModelForm):
class Meta:
model = Company
widgets = {
'phone': TextInput(attrs={'size': 13}),
'tax_id': TextInput(attrs={'size': 6}),
'zip': TextInput(attrs={'size': 6, 'style' : 'width: 80px'}),
}
I am not sure this is the best solution and ....I do not like this (using style inline). Is there any other in the box solution?
Define custom stylesheets within your model admin (media property)
<style type="text/css">
#id_phone {
width: 100px; !important
}
.......
</style>