Re: CBV with inline formset

2014-12-15 Thread Brad Rice
Thanks. I think I figured out how to do this with a straight createView. class BookCreate(CreateView): model = Book form_class = BookForm template_name = 'book_template.html' success_url = u'/dp/thanks' def get(self, request, *args, **kwargs): self.object = None form_class = self.get_form_class()

Re: CBV with inline formset

2014-12-15 Thread Dan Gentry
I created a couple of mixins for a project that might help you. See this gist: https://gist.github.com/dashdrum/03858d79ddfd9bba44d6 Pretty easy to use. Here's an example Create view: class RegistrationView(FormsetCreateMixin,CreateView): template_name = 'registration/registration_form.htm

Re: CBV with inline formset

2014-12-15 Thread Vijay Khemlani
Try changing the name of the parameter in the url from author_id to pk On Mon, Dec 15, 2014 at 5:39 PM, Brad Rice wrote: > > 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 u

CBV with inline formset

2014-12-15 Thread Brad Rice
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(m