mirror of
https://github.com/django/django.git
synced 2025-12-04 00:55:36 +00:00
Fixed #28658 -- Added DISTINCT handling to the Aggregate class.
This commit is contained in:
parent
222caab68a
commit
bc05547cd8
9 changed files with 83 additions and 24 deletions
|
|
@ -1026,7 +1026,7 @@ class AggregateTestCase(TestCase):
|
|||
# test completely changing how the output is rendered
|
||||
def lower_case_function_override(self, compiler, connection):
|
||||
sql, params = compiler.compile(self.source_expressions[0])
|
||||
substitutions = {'function': self.function.lower(), 'expressions': sql}
|
||||
substitutions = {'function': self.function.lower(), 'expressions': sql, 'distinct': ''}
|
||||
substitutions.update(self.extra)
|
||||
return self.template % substitutions, params
|
||||
setattr(MySum, 'as_' + connection.vendor, lower_case_function_override)
|
||||
|
|
@ -1053,7 +1053,7 @@ class AggregateTestCase(TestCase):
|
|||
|
||||
# test overriding all parts of the template
|
||||
def be_evil(self, compiler, connection):
|
||||
substitutions = {'function': 'MAX', 'expressions': '2'}
|
||||
substitutions = {'function': 'MAX', 'expressions': '2', 'distinct': ''}
|
||||
substitutions.update(self.extra)
|
||||
return self.template % substitutions, ()
|
||||
setattr(MySum, 'as_' + connection.vendor, be_evil)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue