Hello,

I have several models with one-to-one relation. For example

class Task(models.Model):
    initial_comment = models.OneToOneField('Comment')
   # A pack of other fields

class Comment(models.Model)
    body = RichTextField()
   # A pack of other fields


I want to create "create view" based on form, that gives user ability to 
create task and initial comment there.

1) I can't use CreateView because it is based on only one model
2) I can't use ModelForm because it is based on only one model
3) I can create several forms, but I can't join them into one formset 
(forms are different)
4) I feel "inlineformset_factory" (InlineFormSet) should be used here, but 
I am not sure it suits best. Is there any 3rd party Django app to do that?

Sure I can create form myself, but I do not want to copy/paste all fields, 
their types, localized labels, validations and so on. I just want to list 
their names (like "fields" attibute).
If you wonder why do I need one-to-one: Comments are used heavily in other 
places and have different relations with different models.

Thank you.

Ilya.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/e5254d86-c237-4192-bf1e-4e2d96722a9f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to