Re: 'FormSet' object has no attribute 'save'
On Sun, Jun 23, 2013 at 4:05 PM, Mário Idival wrote: > Hi guys, > > I need of little help with formsets. I want save 3 instances of an form in > databases. > E.G : > name > lastname > - > name > lastname > - > name > lastname > - > I try use formset but I'm not getting save, expected this error for me :' > ClassNameForSet' object has no attribute 'save' > Somebody know how i can pass for this? Most Formsets do not have a save() method, only ModelFormsets have a save() method. Show your code. Cheers Tom -- 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. For more options, visit https://groups.google.com/groups/opt_out.
Re: 'FormSet' object has no attribute 'save'
Hi, Looks like you've missed something in your code. Unfortunately without the formset creation / instance creation code, there isn't much we can do. Regards, Xavier. Le 23 juin 2013 à 17:05, Mário Idival a écrit : > Hi guys, > > I need of little help with formsets. I want save 3 instances of an form in > databases. > E.G : > name > lastname > - > name > lastname > - > name > lastname > - > I try use formset but I'm not getting save, expected this error for me :' > ClassNameForSet' object has no attribute 'save' > Somebody know how i can pass for this? > > -- > 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. > For more options, visit https://groups.google.com/groups/opt_out. > > -- 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. For more options, visit https://groups.google.com/groups/opt_out.
'FormSet' object has no attribute 'save'
Hi guys, I need of little help with formsets. I want save 3 instances of an form in databases. E.G : name lastname - name lastname - name lastname - I try use formset but I'm not getting save, expected this error for me :' ClassNameForSet' object has no attribute 'save' Somebody know how i can pass for this? -- 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. For more options, visit https://groups.google.com/groups/opt_out.
Re: 'FormSet' object has no attribute 'save'
On Wed, Oct 17, 2012 at 4:49 PM, Tom Evans wrote: > On Wed, Oct 17, 2012 at 7:06 AM, Satinderpal Singh > wrote: >> I used formsets for different forms in my project, it displays the >> forms to user but on submitting the form it gives the following error: >> 'chem_analysisFormFormSet' object has no attribute 'save'. I don't >> know how to save the formset in the views. Here is the code of my >> views file of my project: >> >> def chemical_analysis(request): >> ChemicalFormSet = formset_factory(chem_analysisForm) >> if request.method=='POST': >> formset = ChemicalFormSet(request.POST, >> request.FILES) >> if formset.is_valid(): >> cd = formset.cleaned_data >> formset.save() >> return >> HttpResponseRedirect(reverse('Automation.report.views.result_chem')) >> #return >> render_to_response('report/chemical_analysis.html', >> {'chem': chem,},context_instance=RequestContext(request)) >> else: >> return HttpResponse("There was an error with >> your >> submission. Please try again.") >> >> else: >> formset = ChemicalFormSet() >> return >> render_to_response('report/report_add_row.html', {'formset': >> formset}, context_instance=RequestContext(request)) >> > > Why would it have a save() method? Only model forms and model formsets > have save() methods. Model formsets are defined using the > modelformset_factory factory, not formset_factory. > > https://docs.djangoproject.com/en/1.4/topics/forms/modelforms/#model-formsets Thanks, now i clearly understand my mistake and with your help i am able to run the program successfully. -- Satinderpal Singh http://satindergoraya.blogspot.in/ http://satindergoraya91.blogspot.in/ -- 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+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: 'FormSet' object has no attribute 'save'
On Wed, Oct 17, 2012 at 7:06 AM, Satinderpal Singh wrote: > I used formsets for different forms in my project, it displays the > forms to user but on submitting the form it gives the following error: > 'chem_analysisFormFormSet' object has no attribute 'save'. I don't > know how to save the formset in the views. Here is the code of my > views file of my project: > > def chemical_analysis(request): > ChemicalFormSet = formset_factory(chem_analysisForm) > if request.method=='POST': > formset = ChemicalFormSet(request.POST, request.FILES) > if formset.is_valid(): > cd = formset.cleaned_data > formset.save() > return > HttpResponseRedirect(reverse('Automation.report.views.result_chem')) > #return > render_to_response('report/chemical_analysis.html', > {'chem': chem,},context_instance=RequestContext(request)) > else: > return HttpResponse("There was an error with > your > submission. Please try again.") > > else: > formset = ChemicalFormSet() > return > render_to_response('report/report_add_row.html', {'formset': > formset}, context_instance=RequestContext(request)) > Why would it have a save() method? Only model forms and model formsets have save() methods. Model formsets are defined using the modelformset_factory factory, not formset_factory. https://docs.djangoproject.com/en/1.4/topics/forms/modelforms/#model-formsets Cheers Tom -- 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+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
'FormSet' object has no attribute 'save'
I used formsets for different forms in my project, it displays the forms to user but on submitting the form it gives the following error: 'chem_analysisFormFormSet' object has no attribute 'save'. I don't know how to save the formset in the views. Here is the code of my views file of my project: def chemical_analysis(request): ChemicalFormSet = formset_factory(chem_analysisForm) if request.method=='POST': formset = ChemicalFormSet(request.POST, request.FILES) if formset.is_valid(): cd = formset.cleaned_data formset.save() return HttpResponseRedirect(reverse('Automation.report.views.result_chem')) #return render_to_response('report/chemical_analysis.html', {'chem': chem,},context_instance=RequestContext(request)) else: return HttpResponse("There was an error with your submission. Please try again.") else: formset = ChemicalFormSet() return render_to_response('report/report_add_row.html', {'formset': formset}, context_instance=RequestContext(request)) -- Satinderpal Singh http://satindergoraya.blogspot.in/ http://satindergoraya91.blogspot.in/ -- 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+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.