Re: django forms - overriding constructor for changing field type depending by input
Hey Luke,
I don't think you need to return anything, especially not a super class.
Try this http://dpaste.com/hold/750356/
Cheers,
-m
On 20 May 2012 10:06, luke lukes <lordluke80@gmail.com> wrote:
hi everyone. i need to overrid the constructor of a form: if i have some value in input, some fields has to be ChoiceField, otherwise they have to be CharField. here's the code:but this way doesn't work. even if i declare fields before constructor as CharField and then I ovverride them in __init__, they will not be renderized in template (I got this message: <django.forms.fields.ChoiceField object at 0x7ff0c0173ad0>).I don't understand where's the mistake (also because i have poor python skills...)any help?--
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/lIzEfD5QeZMJ.
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.
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