Monday, December 27, 2010

Re: inline-model-formset help

Thanks, but I'm not sure which models to pass to it, when it asks for two models in this:

"

If you want to create a formset that allows you to edit books belonging to a particular author, you could do this:

>>> from django.forms.models import inlineformset_factory >>> BookFormSet = inlineformset_factory(Author, Book) >>> author = Author.objects.get(name=u'Mike Royko') >>> formset = BookFormSet(instance=author)
"
So in my case, I have LineItem, which is what I need the user to fill in. So that would the inlineform, since I need more than one of those in my view, but what do I use for formset?

In this line: inlineformset_factory(Author, Book)

Not sure how to translate that to my models.

Thanks again.

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment