Re: adding html5 field attributes to a model form
Custom widget would be enough
in your forms.py
from django.forms import Input
class EmailInput(Input):
input_type = 'email'
class AddressForm(ModelForm):
contact_email = forms.CharField(widget=EmailInput)
On Apr 9, 11:37 pm, Lee Hinde <leehi...@gmail.com> wrote:
> Thanks. I'll check that out.
>
> On Apr 9, 2012, at 7:32 PM, creecode wrote:
>
>
>
>
>
>
>
> > Ah I see. I haven't looked deeper in the code I'd guess the type is being set after you set it deeper in the machinery based on field class? Perhaps a custom field could accomplish your goal?
>
> > On Monday, April 9, 2012 7:17:56 PM UTC-7, Lee Hinde wrote:
>
> > Thanks for the response, Creecode,
>
> > I've used that for adding class attributes just fine, but in this case I'm trying to change the field 'type' and that's what doesn't seem to work.
>
> > Toodle-loooooooooooo.....
> > creecode
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home