Hi Marek,
I think that your problem is that the make_car_form function returns a
form class rather than an instance of that class. Once you have the
class you still need to make an instance of it. Something like this
might work:

form_class = make_car_form(True)
carForm = form_class()


Preston


On Mar 19, 7:05 am, Thomas Guettler <h...@tbz-pariv.de> wrote:
> Sorry, I can't help you here, since I don't create classes
> at runtime (*). I think using __init__() is better, and I guess
> you can solve your problem with it, too.
>
> (*) type('ContactForm', (forms.BaseForm, ), { 'base_fields': fields})
>
> Marek W schrieb:
>
>
>
> > Thanks for your response. Probably the reason was I didn't update a
> > database, because now(after making syncdb) it works correctly. But by the
> > time I've found a second problem:
>
> > while to create a dynamic form this way:
>
> > def make_car_form(extra):
> >     fields = { 'carType' : forms.CharField() }
> >     if extra:
> >         fields['extraField'] = forms.CharField()
> >     return type('ContactForm', (forms.BaseForm, ), { 'base_fields': fields
> > })
>
> > View method:
> > (...)
> >     carForm = make_car_form(True)
> > (...)
>
> > then on the page there aren't any fields, whether calling make_car_form with
> > extra=True or extra=False.
>
> --
> Thomas Guettler,http://www.thomas-guettler.de/
> E-Mail: guettli (*) thomas-guettler + de
--~--~---------~--~----~------------~-------~--~----~
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