Hi Thomas, Thank you. I managed to get 2 forms in a view but I dont know how to provide some 'default' data to some fields in the related form.
I'll give you some code: class Infocard(models.Model): from django.conf import settings content_type = models.ForeignKey(ContentType, limit_choices_to = {'id__in': settings.CARD_ITEMS}) object_id = models.PositiveIntegerField('item') content_object = generic.GenericForeignKey() photo = models.ForeignKey(Photo, related_name='infocards', blank=True, null=True, unique=True) text = models.TextField() description = models.TextField(maxlength=300) tag_field = TagField(verbose_name='Keyword(s)') pubdate = models.DateTimeField(auto_now_add=True, editable=False) moddate = models.DateTimeField(auto_now=True, editable=False) publish = models.BooleanField(default=True) author = models.ForeignKey(User, blank=True, null=True) allow_comment = models.BooleanField() class Sectie(models.Model): viewname = models.CharField('url', maxlength=50, unique=True, db_index=True, choices=settings.VIEW_CHOICES,) name = models.CharField(maxlength=70, unique=True, db_index=True) parent = models.ForeignKey('self', blank=True, null=True, verbose_name="parent section", related_name='child_set',) infocard = generic.GenericRelation(Infocard) As you can see, I use an infocard to attach extended information to a section. I can also attach cards to other kind of objects. While adding, or editing a section I want to provide the form for an infocard on the same page. section = get_section_by_viewname_or_none(viewname) SectionForm = forms.models.form_for_instance(section) try: infocard = section.infocard.all()[0:1].get() InfocardForm = forms.models.form_for_instance(infocard) except Infocard.DoesNotExist: InfocardForm = forms.models.form_for_model(Infocard) sform = SectionForm() iform = InfokaartForm() # and now I lost my way In above example I expect a section to exist so I'll get it using a custom function. For the given section I'll call a form. If the section has a card it is fetched and a form is called. Otherwise I call an empty form for it. My question is about the last part, the empty infocard form. Doe you know how to handle it a field value for the content_type and object_id of the given section? Rob --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---