I've pretty much butchered the code for 3 days now and cannot figure out how to insert an inline formset. Can anybody help me?
I've tried to pare everything down to use two simple Models just to try to get an insert. I'm using django Author - Book relationship to keep it simple. class Author(models.Model): name = models.CharField(max_length=100) def __unicode__(self): # __unicode__ on Python 2 return self.name class Book(models.Model): name = models.CharField(max_length=100) author = models.ForeignKey(Author) So I have a page where you can insert and author. The author page takes you to a page to insert books for that author using an inline formset of 3 books. In my urls.py I have this url url(r'^book_create/(?P<author_id>\d+)/$', BookCreate.as_view(), name='book_create'), When you go to book_create I can see the author_id getting passed in the kwargs. Now how to I insert from there books into the db with the Foreign Key to that author passed in the kwargs? After banging away for so long, I decided to try to switch to django extra views. this is what I have in my views.py class BookCreate(InlineFormSetView): model = Author inline_model = Book form_class = BookForm extra = 3 template_name = 'book_template.html' def get_queryset(self): slug = self.kwargs['author_id'] return super(BookCreate, self).get_queryset().filter(id=slug) When I go to the book_create page I get this error: Generic detail view BookCreate must be called with either an object pk or a slug. -- 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/df120546-0931-4b17-93e1-70ba884e62f5%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.