Thanks Daniel,

Now it makes sense.

Thank you again

2010/11/3 Daniel Roseman <dan...@roseman.org.uk>

> On Nov 3, 3:03 pm, "Ricardo L. Dani" <ricardod...@gmail.com> wrote:
> > Hello,
> >
> > I'm working with an project using django-cms and django 1.1 and I have
> this
> > problem:
> >
> > With a big model form with many choice charFields must be reendered as
> > <input type="radio"> and not as <select>'s (default)
> >
> > Ex:
> >
> >     field = models.CharField(max_length=1, default=None, choices=CHOICES)
> >
> > renders:
> >
> >     <select>
> >         <option>
> >         ... etc
> >
> > but i need a <input type="option">
> >
> > With django 1.2 i get this using:
> >
> > class InscricaoForm(ModelForm):
> >
> >     class Meta:
> >         model = Inscricao
> >         widgets ={
> >             'possiveis_areas_de_interesse' : RadioSelect,
> >             'regime_dedicacao_curso' : RadioSelect,
> >             'vinculo_empregaticio' : RadioSelect,
> >             'interesse_bolsa_estudos' : RadioSelect,
> >             'conhecimento_linguas_estrangeiras' : RadioSelect
> >         }
> >
> > but I use django-cms and this not works fine with django 1.2
> >
> > the question: how i do that with django 1.1 ?
> >
> > thanks
> >
> > Ps: sorry for the bad english :/
> >
>
> Your English is fine.
>
> You have to overwrite the field declaration for each one you want to
> change, specifying the `widget` argument:
>
> class InscricaoForm(ModelForm):
>    possiveis_areas_de_interesse =
> forms.ChoiceField(choices=FOO_CHOICES, widget=forms.RadioSelect)
>
> etc. You have to remember to include all the options you've defined
> for your model field - default, max_length, is_required. It's
> unfortunately very verbose, which is why the `widgets` syntax was
> introduced in version 1.2.
> --
> DR.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com<django-users%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>


-- 
Ricardo Lapa Dani
Graduando em Ciência da Computação
Universidade Federal de Ouro Preto

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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