mirror of
https://github.com/django/django.git
synced 2025-08-04 19:08:28 +00:00
Refs #30158 -- Made alias argument required in signature of Expression.get_group_by_cols() subclasses.
Per deprecation timeline.
This commit is contained in:
parent
d134b0b93e
commit
5e33ec80d1
3 changed files with 6 additions and 38 deletions
|
@ -1,24 +0,0 @@
|
|||
from django.db.models import Count, Func
|
||||
from django.test import SimpleTestCase
|
||||
from django.utils.deprecation import RemovedInDjango40Warning
|
||||
|
||||
from .models import Employee
|
||||
|
||||
|
||||
class MissingAliasFunc(Func):
|
||||
template = '1'
|
||||
|
||||
def get_group_by_cols(self):
|
||||
return []
|
||||
|
||||
|
||||
class GetGroupByColsTest(SimpleTestCase):
|
||||
def test_missing_alias(self):
|
||||
msg = (
|
||||
'`alias=None` must be added to the signature of '
|
||||
'expressions.test_deprecation.MissingAliasFunc.get_group_by_cols().'
|
||||
)
|
||||
with self.assertRaisesMessage(RemovedInDjango40Warning, msg):
|
||||
Employee.objects.values(
|
||||
one=MissingAliasFunc(),
|
||||
).annotate(cnt=Count('company_ceo_set'))
|
Loading…
Add table
Add a link
Reference in a new issue