Search code examples
djangodjango-paypal

django-paypal signal update


I've been picking my way though django-paypal documentation and have got a signal connecting when I send a IPN from the sandbox simulator.

I can do:

UserProfile.objects.update(has_paid=True)

I can also do:

UserProfile.objects.update(middle_name=sender.custom) # sender.custom set to "Lyndon" on IPN

and everyone gets a year free. Not what I want... What I'd like to do is

up = UserProfile.objects.get(user=ipn_obj.custom)
up.has_paid = False
up.save()

but on such occasions I get a server error (500) message on the Instant Payment Notification (IPN) simulator.

IPN delivery failed. HTTP error code 500: Internal Server Error

I still get a Paypal IPN in my database and it will show up not flagged and with a payment status of "Completed". However, the signal is not connecting.

I'm just not getting something (or multiple things!) here. Any pointers much appreciated.

T


Solution

  • It would help if I paid attention...

    up = UserProfile.objects.get(user.username=ipn_obj.custom)
    

    user.username...