From 6379537b053b9e73e67c83a45f08e7ffdea1f1d6 Mon Sep 17 00:00:00 2001 From: Thomas Steen Rasmussen Date: Wed, 1 Jun 2016 01:16:32 +0200 Subject: [PATCH] see if refresh_from_db() helps here --- shop/views.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/shop/views.py b/shop/views.py index ec424496..dbe5b489 100644 --- a/shop/views.py +++ b/shop/views.py @@ -398,9 +398,14 @@ class CoinifyRedirectView(LoginRequiredMixin, EnsureUserOwnsOrderMixin, EnsureUn order.coinifyapiinvoice.delete() if hasattr(order, 'coinifyapiinvoice'): print "deleted coinifyapiinvoice but order %s still hasattr(coinifyapiinvoice), sleeping 5 secs" % order.pk - time.sleep(5) + time.sleep(2) if hasattr(order, 'coinifyapiinvoice'): - print "deleted coinifyapiinvoice and slept 5 secs but order %s still hasattr(coinifyapiinvoice), what the fuck" % order.pk + print "deleted coinifyapiinvoice and slept 2 secs but order %s still hasattr(coinifyapiinvoice), what the fuck" % order.pk + order.refresh_from_db() + if hasattr(order, 'coinifyapiinvoice'): + print "refreshed order %s from db but it still hasattr(coinifyapiinvoice), what the fuck" % order.pk + else: + print "refreshed order %s from db which helped" % order.pk # create a new coinify invoice if needed print "checking if order %s has coinifyapiinvoice" % order.pk