mirror of
https://github.com/Hopiu/django.git
synced 2026-05-04 05:34:45 +00:00
Simplified Count.convert_value() and RegrCount.convert_value().
This commit is contained in:
parent
86a18dc46a
commit
873858009c
2 changed files with 2 additions and 6 deletions
|
|
@ -42,9 +42,7 @@ class RegrCount(StatAggregate):
|
|||
output_field = IntegerField()
|
||||
|
||||
def convert_value(self, value, expression, connection):
|
||||
if value is None:
|
||||
return 0
|
||||
return int(value)
|
||||
return 0 if value is None else value
|
||||
|
||||
|
||||
class RegrIntercept(StatAggregate):
|
||||
|
|
|
|||
|
|
@ -125,9 +125,7 @@ class Count(Aggregate):
|
|||
return dict(options, distinct=self.extra['distinct'] != '')
|
||||
|
||||
def convert_value(self, value, expression, connection):
|
||||
if value is None:
|
||||
return 0
|
||||
return int(value)
|
||||
return 0 if value is None else value
|
||||
|
||||
|
||||
class Max(Aggregate):
|
||||
|
|
|
|||
Loading…
Reference in a new issue