mirror of
https://github.com/django/django.git
synced 2025-10-24 22:26:08 +00:00
Fixed #22057 -- Ensured reverse_lazy can be used in settings
And without causing a circular import. Thanks Akis Kesoglou for the report.
This commit is contained in:
@@ -5,16 +5,12 @@ import copy
|
||||
|
||||
from django.db.models.fields import IntegerField, FloatField
|
||||
from django.db.models.lookups import RegisterLookupMixin
|
||||
from django.utils.functional import cached_property
|
||||
|
||||
|
||||
__all__ = ['Aggregate', 'Avg', 'Count', 'Max', 'Min', 'StdDev', 'Sum', 'Variance']
|
||||
|
||||
|
||||
# Fake fields used to identify aggregate types in data-conversion operations.
|
||||
ordinal_aggregate_field = IntegerField()
|
||||
computed_aggregate_field = FloatField()
|
||||
|
||||
|
||||
class Aggregate(RegisterLookupMixin):
|
||||
"""
|
||||
Default SQL Aggregate.
|
||||
@@ -61,14 +57,23 @@ class Aggregate(RegisterLookupMixin):
|
||||
|
||||
while tmp and isinstance(tmp, Aggregate):
|
||||
if getattr(tmp, 'is_ordinal', False):
|
||||
tmp = ordinal_aggregate_field
|
||||
tmp = self._ordinal_aggregate_field
|
||||
elif getattr(tmp, 'is_computed', False):
|
||||
tmp = computed_aggregate_field
|
||||
tmp = self._computed_aggregate_field
|
||||
else:
|
||||
tmp = tmp.source
|
||||
|
||||
self.field = tmp
|
||||
|
||||
# Two fake fields used to identify aggregate types in data-conversion operations.
|
||||
@cached_property
|
||||
def _ordinal_aggregate_field(self):
|
||||
return IntegerField()
|
||||
|
||||
@cached_property
|
||||
def _computed_aggregate_field(self):
|
||||
return FloatField()
|
||||
|
||||
def relabeled_clone(self, change_map):
|
||||
clone = copy.copy(self)
|
||||
if isinstance(self.col, (list, tuple)):
|
||||
|
||||
Reference in New Issue
Block a user