Джанго-пайпал "POST /notify/ HTTP/1.0" 500 59

   [31/Mar/2015 12:20:55] "POST /notify/ HTTP/1.0" 500 59

Я получаю эту ошибку и не более. сигнал просто не подключается

   @csrf_exempt
   def showme(sender,  **kwargs):
       ipn_obj = sender
       if ipn_obj.payment_status  == "Completed":
         user_profile = auth_user.objects.get(id=ipn_obj.custom)
         if user_profile.balance==None:
         user_profile.balance = float(10)
         else:
         user_profile.balance += float(10)
         user_profile.save()

  payment_was_successful.connect(showme)

URL моего уведомления

   @csrf_exempt
   def notify(request):
       payment_was_successful.connect(showme)
       return HttpResponse('OK4')

1 ответ

Решение

ИСПРАВИТЬ ошибку, вручную добавив логику уведомления URL

@csrf_exempt
def notify(request):
    if request.POST.get("payment_status")  == "Completed":
     user_profile = auth_user.objects.get(id=request.POST.get("custom"))
     if user_profile.balance==None:
     user_profile.balance = float(10)
     else:
     user_profile.balance += float(10)
     user_profile.save()
     return HttpResponse('OK4')
Другие вопросы по тегам