hi,

im trying to create a form based on 2 models where model B will be a
inlineformset related to model A.
how can i tell the formset forms (model B) that the related instance is
the just created instance based on model A?

lets say i want to create the author and assign him many books in one shot.
i get the form displayed but after the submit i get a:

    Cannot assign "<Book: >": "Book.author" must be a "Author" instance.

      

http://docs.djangoproject.com/en/dev/topics/forms/modelforms/#using-an-inline-formset-in-a-view

only tells how to create Book instances related to an existing author.
(i admit i didnt try to hard today)

another question i have is: do i have to define the amount of books in
advance with extra= or is there a way to get a plus icon where i can
click on and get a formset.form more displayed?
http://docs.djangoproject.com/en/dev/topics/forms/formsets/#s-adding-additional-fields-to-a-formset
here i can see an explaination about how to add fields... i would need
something like can_delete or can_order but for adding new forms to the
formset.

thank you
 

--

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