Hi, can somebody give me a hint how to subclass a form_for_model class? I have read ticket 3815, but that doesn't seem to work too well for me. If I simply subclass the Form, the new fields aren't added if I subclass with argument form=newforms.Form only the new fields are there (see below for details) Any suggestions?
thanks, Sean In [1]: from django import newforms as forms In [2]: from polls import models In [4]: PollForm = forms.form_for_model(models.Poll) In [6]: class PollFormWithTest(PollForm): ...: test = forms.CharField() In [7]: testForm=PollFormWithTest() In [8]: testForm.fields Out[8]: {'question': <django.newforms.fields.CharField object at 0x100a390>, 'pub_date': <django.newforms.fields.DateTimeField object at 0x100a310>} In [9]: testForm.test Out[9]: <django.newforms.fields.CharField object at 0x100a250> # Now the recommended way (http://code.djangoproject.com/ticket/3815) In [13]: PollForm2 =forms.form_for_model(models.Poll,form=forms.Form) In [14]: class PollFormWithTest(PollForm2): test = forms.CharField() ....: In [16]: testForm=PollFormWithTest() In [17]: testForm.fields Out[17]: {'test': <django.newforms.fields.CharField object at 0x100a6d0>} --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---