How to display a form filed with size and maxlength attributes in Django?
django, django-forms, django-templates
Solution
Like this:
class MyForm(forms.Form):
myfield = forms.CharField(widget=forms.TextInput(attrs={'size':5, 'maxlength':5})
Read the forms documentation.
Problem
I have a model form that contains a DecimalField() with max_digits set to 5. How do I display this field this way: ``` <input type"text" size="5" maxlength="5" /> ```