def get_transaction_statuses(): payments = Payment.objects.filter(status__in=(Payment.STATUS_NEW, Payment.STATUS_PENDING), created__lt=(timezone.now() - datetime.timedelta(minutes=10))) for payment in payments: validate_payment(payment) return True
def get(self, request, *args, **kwargs): self.object = self.get_object() if self.object.status == Payment.STATUS_OK: if self.object.content_type.model == 'application': return HttpResponseRedirect(reverse('application_ok', kwargs={'slug': self.object.content_object.code})) elif self.object.content_type.model == 'team': return HttpResponseRedirect(reverse('accounts:team', kwargs={'pk2': self.object.content_object.id})) return validate_payment(self.object, user=True, request=request)