From bfed64c38a3ef260b532948b8da95be2cd627d09 Mon Sep 17 00:00:00 2001 From: Todd Dembrey <todd.dembrey@torchbox.com> Date: Mon, 24 Feb 2020 17:14:33 +0000 Subject: [PATCH] Lint: order and stop weird "as" behaviour --- hypha/apply/projects/models.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/hypha/apply/projects/models.py b/hypha/apply/projects/models.py index 18925cd06..177520471 100644 --- a/hypha/apply/projects/models.py +++ b/hypha/apply/projects/models.py @@ -14,16 +14,16 @@ from django.core.exceptions import ValidationError from django.core.validators import MinValueValidator from django.db import models from django.db.models import ( - Count, Case, - F, + Count, ExpressionWrapper, + F, Max, OuterRef, Q, Subquery, Sum, - Value as V, + Value, When, ) from django.db.models.functions import Cast, Coalesce @@ -182,7 +182,7 @@ class PaymentRequestQueryset(models.QuerySet): return self.exclude(status=DECLINED) def total_value(self, field): - return self.aggregate(total=Coalesce(Sum(field), V(0)))['total'] + return self.aggregate(total=Coalesce(Sum(field), Value(0)))['total'] def paid_value(self): return self.filter(status=PAID).total_value('paid_value') @@ -309,7 +309,7 @@ class ProjectQuerySet(models.QuerySet): def with_amount_paid(self): return self.annotate( - amount_paid=Coalesce(Sum('payment_requests__paid_value'), V(0)), + amount_paid=Coalesce(Sum('payment_requests__paid_value'), Value(0)), ) def with_last_payment(self): -- GitLab