On Thu, Nov 1, 2012 at 6:32 PM, Satinderpal Singh < [email protected]> wrote:
> On Thu, Nov 1, 2012 at 1:25 AM, Lachlan Musicman <[email protected]>wrote: > >> On Thu, Nov 1, 2012 at 7:30 AM, Satinderpal Singh >> <[email protected]> wrote: >> > I use formset in my views.py file for the forms. It saves the entries >> from >> > the form to the database but the problem is that it shows all the >> previous >> > forms along with the new form for the new entry. The code for my views >> file >> > is given below: >> > >> > def chemical_analysis(request): >> > ChemicalFormSet = modelformset_factory(chem_analysis) >> > if request.method=='POST': >> > formset = ChemicalFormSet(request.POST, request.FILES) >> > if formset.is_valid(): >> > cd = formset.cleaned_data >> > formset.save() >> >> Should that be cd.save()? Where else is cd used? > > No other cd is used in this view, and i did not get your above logic, > cd.save() > >> >> I think you are saying you don't understand my response? I'm asking if the problem is fixed by replacing formset.save() - with cd.save(), since you have cd = formset.cleaned_data but no other instances of cd, making it kinda useless? should here be a cd = ObjectName() in there? L. > > return >> HttpResponseRedirect(reverse('Automation.report.views.result_chem')) >> > 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)) >> > >> > Any help will be appreciated. >> > >> > -- >> > 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 [email protected]. >> > 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. >> >> >> >> -- >> ...we look at the present day through a rear-view mirror. This is >> something Marshall McLuhan said back in the Sixties, when the world >> was in the grip of authentic-seeming future narratives. He said, “We >> look at the present through a rear-view mirror. We march backwards >> into the future.” >> >> http://www.warrenellis.com/?p=14314 >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Django users" group. >> To post to this group, send email to [email protected]. >> 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. >> >> > > > -- > 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 [email protected]. > 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. > -- ...we look at the present day through a rear-view mirror. This is something Marshall McLuhan said back in the Sixties, when the world was in the grip of authentic-seeming future narratives. He said, “We look at the present through a rear-view mirror. We march backwards into the future.” http://www.warrenellis.com/?p=14314 -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to [email protected]. 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.

