mirror of
https://github.com/Hopiu/django-modeltranslation.git
synced 2026-05-18 01:21:09 +00:00
Fix values_list + annotate combo bug (close #374).
This commit is contained in:
parent
f0503c2b2d
commit
2f227a45af
2 changed files with 5 additions and 1 deletions
|
|
@ -525,7 +525,7 @@ else:
|
|||
# Django >=1.8
|
||||
fields += tuple(f for f in self.annotation_names if f not in fields)
|
||||
for row in super(FallbackValuesListQuerySet, self).iterator():
|
||||
if self.flat and len(fields) == 1:
|
||||
if self.flat and len(self.original_fields) == 1:
|
||||
yield row[fields[0]]
|
||||
else:
|
||||
yield tuple(row[f] for f in fields)
|
||||
|
|
|
|||
|
|
@ -2608,6 +2608,10 @@ class TestManager(ModeltranslationTestBase):
|
|||
'description': None, 'description_en': None, 'description_de': None},
|
||||
])
|
||||
|
||||
# annotation issue (#374)
|
||||
self.assertEqual(list(manager.values_list('title', flat=True).annotate(Count('title'))),
|
||||
['en'])
|
||||
|
||||
def test_values_list_annotation(self):
|
||||
models.TestModel(title='foo').save()
|
||||
models.TestModel(title='foo').save()
|
||||
|
|
|
|||
Loading…
Reference in a new issue