Message from discussion
Problem with formset
Received: by 10.59.0.73 with SMTP id aw9mr14563531ved.1.1351800685924;
Thu, 01 Nov 2012 13:11:25 -0700 (PDT)
X-BeenThere: django-users@googlegroups.com
Received: by 10.220.226.7 with SMTP id iu7ls2831906vcb.6.gmail; Thu, 01 Nov
2012 13:11:02 -0700 (PDT)
Received: by 10.58.210.198 with SMTP id mw6mr14599732vec.22.1351800662480;
Thu, 01 Nov 2012 13:11:02 -0700 (PDT)
Received: by 10.58.210.198 with SMTP id mw6mr14599731vec.22.1351800662444;
Thu, 01 Nov 2012 13:11:02 -0700 (PDT)
Return-Path: <data...@gmail.com>
Received: from mail-vb0-f49.google.com (mail-vb0-f49.google.com [209.85.212.49])
by gmr-mx.google.com with ESMTPS id dj17si1020467vdb.1.2012.11.01.13.11.02
(version=TLSv1/SSLv3 cipher=OTHER);
Thu, 01 Nov 2012 13:11:02 -0700 (PDT)
Received-SPF: pass (google.com: domain of data...@gmail.com designates 209.85.212.49 as permitted sender) client-ip=209.85.212.49;
Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of data...@gmail.com designates 209.85.212.49 as permitted sender) smtp.mail=data...@gmail.com; dkim=pass header...@gmail.com
Received: by mail-vb0-f49.google.com with SMTP id fo1so3014072vbb.36
for <django-users@googlegroups.com>; Thu, 01 Nov 2012 13:11:02 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20120113;
h=mime-version:in-reply-to:references:date:message-id:subject:from:to
:content-type;
bh=dvTO5ebEjIthvl7Yva1Ltmm3LjVqMkURtoU4J5cdQgg=;
b=sBcNXTAuG0k2NtmX5nW+mv+QS+ZMvcBsPI6nO/7ickleXZsMX0Z+Rh1a0LEknjcBWr
9srCz0xuwrE1tgs0DlNXovO95J1Mdh5Cq3DHbllHPhK6wNv62+CJ3S2fCtDoLwCFbSMg
5WrZr8jsQ4ksq4wRUx/s7LMVZup2eSsfWCQfi+rnfkpqsn2C6HV67o0yLTZlML3UtkCV
7DSbiz6MAyWTpwPR2sQkCB07FOMb2o/h3MyFX1DIdFDdG6ZWnmsmFuwlACRbUBz9vga2
04oyOJ5MipBfebp7Nuh86o11xGZpXa0AA+84cQqIEr0UgWyQqOHb+7W9ceONrHUPjFmv
M3NQ==
MIME-Version: 1.0
Received: by 10.58.207.196 with SMTP id ly4mr8983781vec.6.1351800662261; Thu,
01 Nov 2012 13:11:02 -0700 (PDT)
Received: by 10.220.13.132 with HTTP; Thu, 1 Nov 2012 13:11:02 -0700 (PDT)
In-Reply-To: <CA+iK19++83R1yr0nU_Qh-4dBUr892SX-u28QzFt27=4_peX...@mail.gmail.com>
References: <CA+iK19LLOZG5of4UAfGkG94JbOjRZBtUki_5HK2W_2-kUx4...@mail.gmail.com>
<CAGBeqiOGsZ1p=7vi1FxLNa6fhJPNMgY-DfadvAVeexpzNp=...@mail.gmail.com>
<CA+iK19++83R1yr0nU_Qh-4dBUr892SX-u28QzFt27=4_peX...@mail.gmail.com>
Date: Fri, 2 Nov 2012 09:11:02 +1300
Message-ID: <CAGBeqiNxKsrHr7xoH-GiNCSOkabDVBkR8_3NTWWP0AH4QUA...@mail.gmail.com>
Subject: Re: Problem with formset
From: Lachlan Musicman <data...@gmail.com>
To: django-users@googlegroups.com
Content-Type: multipart/alternative; boundary=047d7b86eab848006104cd749ed1
--047d7b86eab848006104cd749ed1
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
On Thu, Nov 1, 2012 at 6:32 PM, Satinderpal Singh <
satinder.goray...@gmail.com> wrote:
> On Thu, Nov 1, 2012 at 1:25 AM, Lachlan Musicman <data...@gmail.com>wrote=
:
>
>> On Thu, Nov 1, 2012 at 7:30 AM, Satinderpal Singh
>> <satinder.goray...@gmail.com> 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 =3D modelformset_factory(chem_analysis)
>> > if request.method=3D=3D'POST':
>> > formset =3D ChemicalFormSet(request.POST, request.FILE=
S)
>> > if formset.is_valid():
>> > cd =3D 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 =3D formset.cleaned_data but no other instances of cd, making it
kinda useless?
should here be a cd =3D 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 =3D ChemicalFormSet()
>> > return render_to_response('report/report_add_row.html', {'formset':
>> > formset}, context_instance=3DRequestContext(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 django-users@googlegroups.com.
>> > To unsubscribe from this group, send email to
>> > django-users+unsubscribe@googlegroups.com.
>> > For more options, visit this group at
>> > http://groups.google.com/group/django-users?hl=3Den.
>>
>>
>>
>> --
>> ...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, =E2=80=
=9CWe
>> look at the present through a rear-view mirror. We march backwards
>> into the future.=E2=80=9D
>>
>> http://www.warrenellis.com/?p=3D14314
>>
>> --
>> You received this message because you are subscribed to the Google Group=
s
>> "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+unsubscribe@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=3Den.
>>
>>
>
>
> --
> 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+unsubscribe@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=3Den.
>
--=20
...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, =E2=80=9CWe look at the pr=
esent
through a rear-view mirror. We march backwards into the future.=E2=80=9D
http://www.warrenellis.com/?p=3D14314
--047d7b86eab848006104cd749ed1
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
On Thu, Nov 1, 2012 at 6:32 PM, Satinderpal Singh <span dir=3D"ltr"><<a =
href=3D"mailto:satinder.goray...@gmail.com" target=3D"_blank">satinder.gora=
y...@gmail.com</a>></span> wrote:<br><div class=3D"gmail_extra"><div cla=
ss=3D"gmail_quote">
<blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p=
x #ccc solid;padding-left:1ex">On Thu, Nov 1, 2012 at 1:25 AM, Lachlan Musi=
cman <span dir=3D"ltr"><<a href=3D"mailto:data...@gmail.com" target=3D"_=
blank">data...@gmail.com</a>></span> wrote:<br>
<div class=3D"gmail_extra"><div class=3D"gmail_quote"><div class=3D"im">
<blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p=
x #ccc solid;padding-left:1ex"><div>On Thu, Nov 1, 2012 at 7:30 AM, Satinde=
rpal Singh<br>
<<a href=3D"mailto:satinder.goray...@gmail.com" target=3D"_blank">satind=
er.goray...@gmail.com</a>> wrote:<br>
> I use formset in my views.py file for the forms. It saves the entries =
from<br>
> the form to the database but the problem is that it shows all the prev=
ious<br>
> forms along with the new form for the new entry. The code for my views=
file<br>
> is given below:<br>
><br>
> def chemical_analysis(request):<br>
> ChemicalFormSet =3D modelformset_factory(chem_analysis)<br>
> if request.method=3D=3D'POST':<br>
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 formset =3D Ch=
emicalFormSet(request.POST, request.FILES)<br>
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if formset.is_=
valid():<br>
> cd =3D formset.cleaned_data<br>
> formset.save()<br>
<br>
</div>Should that be cd.save()? Where else is cd used?</blockquote></div><d=
iv>No other cd is used in this view, and i did not get your above logic, cd=
.save()=C2=A0</div><div><div class=3D"h5"><blockquote class=3D"gmail_quote"=
style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>
<br></div></blockquote></div></div></div></div></blockquote><div><br></div>=
<div>I think you are saying you don't understand my response? I'm a=
sking if the problem is fixed by replacing formset.save() - with cd.save(),=
since you have cd =3D formset.cleaned_data but no other instances of cd, m=
aking it kinda useless?</div>
<div><br></div><div>should here be a cd =3D ObjectName() in there?</div><di=
v><br></div><div><br></div><div>L.</div><div><br></div><div><br></div><div>=
=C2=A0</div><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;bo=
rder-left:1px #ccc solid;padding-left:1ex">
<div class=3D"gmail_extra"><div class=3D"gmail_quote"><div><div class=3D"h5=
"><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:=
1px #ccc solid;padding-left:1ex"><div>
> return HttpResponseRedirect(reverse('Automation.report.views.resul=
t_chem'))<br>
> else:<br>
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 return HttpResponse("There was an err=
or with your submission. Please<br>
> try again.")<br>
> else:<br>
> formset =3D ChemicalFormSet()<br>
> return render_to_response('report/report_add_row.html', {'=
formset':<br>
> formset}, context_instance=3DRequestContext(request))<br>
><br>
> Any help will be appreciated.<br>
><br>
> --<br>
> Satinderpal Singh<br>
> <a href=3D"http://satindergoraya.blogspot.in/" target=3D"_blank">http:=
//satindergoraya.blogspot.in/</a><br>
> <a href=3D"http://satindergoraya91.blogspot.in/" target=3D"_blank">htt=
p://satindergoraya91.blogspot.in/</a><br>
><br>
</div>> --<br>
> You received this message because you are subscribed to the Google Gro=
ups<br>
> "Django users" group.<br>
> To post to this group, send email to <a href=3D"mailto:django-users@go=
oglegroups.com" target=3D"_blank">django-users@googlegroups.com</a>.<br>
> To unsubscribe from this group, send email to<br>
> <a href=3D"mailto:django-users%2Bunsubscribe@googlegroups.com" target=
=3D"_blank">django-users+unsubscribe@googlegroups.com</a>.<br>
> For more options, visit this group at<br>
> <a href=3D"http://groups.google.com/group/django-users?hl=3Den" target=
=3D"_blank">http://groups.google.com/group/django-users?hl=3Den</a>.<br>
<span><font color=3D"#888888"><br>
<br>
<br>
--<br>
...we look at the present day through a rear-view mirror. This is<br>
something Marshall McLuhan said back in the Sixties, when the world<br>
was in the grip of authentic-seeming future narratives. He said, =E2=80=9CW=
e<br>
look at the present through a rear-view mirror. We march backwards<br>
into the future.=E2=80=9D<br>
<br>
<a href=3D"http://www.warrenellis.com/?p=3D14314" target=3D"_blank">http://=
www.warrenellis.com/?p=3D14314</a><br>
<br>
--<br>
You received this message because you are subscribed to the Google Groups &=
quot;Django users" group.<br>
To post to this group, send email to <a href=3D"mailto:django-users@googleg=
roups.com" target=3D"_blank">django-users@googlegroups.com</a>.<br>
To unsubscribe from this group, send email to <a href=3D"mailto:django-user=
s%2Bunsubscribe@googlegroups.com" target=3D"_blank">django-users+unsubscrib=
e@googlegroups.com</a>.<br>
For more options, visit this group at <a href=3D"http://groups.google.com/g=
roup/django-users?hl=3Den" target=3D"_blank">http://groups.google.com/group=
/django-users?hl=3Den</a>.<br>
<br>
</font></span></blockquote></div></div></div><div><div class=3D"h5"><br><br=
clear=3D"all"><div><br></div>-- <br>Satinderpal Singh<br><a href=3D"http:/=
/satindergoraya.blogspot.in/" target=3D"_blank">http://satindergoraya.blogs=
pot.in/</a><br>
<a href=3D"http://satindergoraya91.blogspot.in/" target=3D"_blank">http://s=
atindergoraya91.blogspot.in/</a><br>
</div></div></div><div class=3D"HOEnZb"><div class=3D"h5">
<p></p>
-- <br>
You received this message because you are subscribed to the Google Groups &=
quot;Django users" group.<br>
To post to this group, send email to <a href=3D"mailto:django-users@googleg=
roups.com" target=3D"_blank">django-users@googlegroups.com</a>.<br>
To unsubscribe from this group, send email to <a href=3D"mailto:django-user=
s%2Bunsubscribe@googlegroups.com" target=3D"_blank">django-users+unsubscrib=
e@googlegroups.com</a>.<br>
For more options, visit this group at <a href=3D"http://groups.google.com/g=
roup/django-users?hl=3Den" target=3D"_blank">http://groups.google.com/group=
/django-users?hl=3Den</a>.<br>
</div></div></blockquote></div><br><br clear=3D"all"><div><br></div>-- <br>=
...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, =E2=80=9CWe look at the pr=
esent through a rear-view mirror. We march backwards into the future.=E2=80=
=9D<br>
<br><a href=3D"http://www.warrenellis.com/?p=3D14314" target=3D"_blank">htt=
p://www.warrenellis.com/?p=3D14314</a><br>
</div>
--047d7b86eab848006104cd749ed1--