tags:

views:

24

answers:

1

I have a simple view, but can't get it to do what it's supposed to, which is simply flip a Boolean Value:

def change_status(request):
 request.user.get_profile().active=not request.user.get_profile().active
 return render_to_response('holdstatus.html', {
  'user' : request.user,
 })

In addition to "not", I've tried '-' and '!', but all to no avail.

+2  A: 

You need to save the changes to the database.

def change_status(request):
    profile = request.user.get_profile()
    profile.active = not profile.active
    profile.save()
    return render_to_response('holdstatus.html', {
       'user': request.user,
    })
icktoofay
Thank you! That worked perfectly. Glad I wasn't *too* far off.
Michael Morisy