views:

32

answers:

1

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" />
+3  A: 

Like this:

class MyForm(forms.Form):
    myfield = forms.CharField(widget=forms.TextInput(attrs={'size':5, 'maxlength':5})

Read the forms documentation.

Daniel Roseman