#24626: widgets property doesn't work in ModelForm
----------------------------+--------------------
Reporter: lipemorais | Owner: nobody
Type: Bug | Status: new
Component: Forms | Version: 1.7
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
----------------------------+--------------------
The widgets property of the ModelForm doesn't work as expected adding a
class on the input.
{{{
from django.forms import DateField, CharField, PasswordInput, TextInput
from django.contrib.auth.forms import UserCreationForm, AuthenticationForm
from login.models import Fan
class FanForm(UserCreationForm):
birthday = DateField(input_formats=['%d-%m-%Y', '%d/%m/%Y'])
class Meta:
model = Fan
fields = ['username', 'email', 'first_name', 'last_name',
'birthday', 'gender', 'password1', 'password2']
widgets = {
'username': TextInput(attrs={'data': 'meu nome', 'class': 'my-
class'}),
}
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/24626>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/053.944758bce668094c808f1f6acce6ee9a%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.