saving a model instance in a view

26 views
Skip to first unread message

MikeKJ

unread,
Apr 5, 2012, 6:51:39 AM4/5/12
to django...@googlegroups.com
c = Name.objects.get(trans_id = request.GET.get('trans_id'))
if c:
     u = Name()
     c.paid = 1
     u.save()

This isnt saving to same object but adding a blank row and not even changing the boolean value field of paid, someone please point out my error that I cannot see

MikeKJ

unread,
Apr 5, 2012, 6:53:26 AM4/5/12
to django...@googlegroups.com

Gaaah another brain fart, forget this one too

kenneth gonsalves

unread,
Apr 5, 2012, 6:56:38 AM4/5/12
to django...@googlegroups.com
On Thu, 2012-04-05 at 03:51 -0700, MikeKJ wrote:
> c = Name.objects.get(trans_id = request.GET.get('trans_id'))
> if c:
> u = Name()
> c.paid = 1
> u.save()

if c:
c.paid=1
c.save()
--
regards
Kenneth Gonsalves

Reply all
Reply to author
Forward
0 new messages