Well, i've spent countless hours on this, and it was so easy.. I guess it could be added to the docs since It's a really nice feature.
I've posted my very bad view code at dpaste, but it might be enough if anyone who has a similar problem http://dpaste.com/hold/96937/ On Dec 8, 4:28 am, Marco Louro <[EMAIL PROTECTED]> wrote: > Thanks for quick reply Malcom. > > This is the code for my view. > I know I'm missing something, the formsets do show up correctly on the > form page, but I'm just not seeing how to load the request.POST data > into the formset for validation and save > > The error I get is: > Exception Value: 'Manager' object has no attribute 'empty' > Exception Location: /usr/lib/python2.5/site-packages/django/contrib/ > contenttypes/generic.py in get_queryset, line 310 > > def add(request,contact_type): > > AddressFormSet = generic_inlineformset_factory(Address, extra=2) > > if request.method == 'POST': > address_formset = AddressFormSet(request.POST,request.FILES) > else: > address_formset = AddressFormSet(instance=Person.objects.get > (id=2)) > > I've also tried loading with > address_formset = AddressFormSet(Person,BaseGenericInlineFormSet > (request.POST,request.FILES)) > > Exception Value: > 'NoneType' object has no attribute '_meta' > Exception Location: /usr/lib/python2.5/site-packages/django/contrib/ > contenttypes/generic.py in __init__, line 295 > > On Dec 8, 4:07 am, Malcolm Tredinnick <[EMAIL PROTECTED]> > wrote: > > > On Sun, 2008-12-07 at 19:46 -0800, Marco Louro wrote: > > > Hi, > > > > I'm trying to use generic_inlineformset_factory. There are no docs for > > > it except a Generic Relations Model example @ > > >http://www.djangoproject.com/documentation/models/generic_relations/ > > > on the bottom (GenericInlineFormSet tests) > > > > My question here is how to pass the POST vars to it? > > > > In a modelformset_factory the following works: > > > formset = AddressFormSet(request.POST, request.FILES) > > > > but here it is not the case.. > > > Can you be specific about what is not working? If you look at the source > > for GenericInlineFormset, it certainly takes those parameters as the > > first two arguments. So what are you actually doing and what error are > > you seeing? (trim your example down the smallest possible code that > > shows the problem so we don't have to wade through dozens of lines.) > > > Regards, > > Malcolm --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---