I think you need self.fields[field_name] = your new field.
Paul


On May 20, 2012, at 7:49 AM, luke lukes <lordluk...@gmail.com> wrote:

> Hi. already tried this way --> fields are instantiated 
> (<django.forms.fields.ChoiceField object at 0x7f6204206f10>) but are not 
> rendered in the template...
> 
> Il giorno domenica 20 maggio 2012 03:25:36 UTC+2, somecallitblues ha scritto:
> 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 <lordluk...@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:
> 
> http://dpaste.com/750343/
> 
> 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+unsubscr...@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 view this discussion on the web visit 
> https://groups.google.com/d/msg/django-users/-/a67HgD8GqvgJ.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to