#29468: Form Field declaration:
-------------------------------------+-------------------------------------
Reporter: Ivan Muller | Owner: nobody
Type: | Status: new
Cleanup/optimization |
Component: Forms | Version: master
Severity: Normal | Resolution:
Keywords: Field Widget html | Triage Stage:
attrs | Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Description changed by Ivan Muller:
Old description:
> Hi guys, I want to improve the way of declaring html attrs into a
> Fields With out declaring the default widget again.
>
> {{{
> example:
> class ProfileForm(forms.ModelForm):
> class Meta:
> model = Profile
> full_name = forms.CharField(widget=forms.TextInput(attrs={'class':
> Anyclass',}))
> }}}
>
>
> As Field documentaiton say into the init:
> """Each Field has a default Widget that it'll use if you don't specify
> this. n most cases, the default widget is TextInput:"""
> Woudl be god to declare it as
>
> {{{
> full_name = forms.CharField(widget_attrs={'class': Anyclass',})
> }}}
New description:
Hi guys, I want to improve the way of declear html attrs into a Fields
With out declaring the default widget again.
{{{
example:
class ProfileForm(forms.ModelForm):
class Meta:
model = Profile
full_name = forms.CharField(widget=forms.TextInput(attrs={'class':
Anyclass',}))
}}}
As Field documentaiton say into the init:
"""Each Field has a default Widget that it'll use if you don't specify
this. n most cases, the default widget is TextInput:"""
Woudl be god to declare it as
{{{
full_name = forms.CharField(widget_attrs={'class': Anyclass',})
}}}
--
--
Ticket URL: <https://code.djangoproject.com/ticket/29468#comment:1>
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/068.57a250cf0d2a5ef3c75442214b03cf21%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.