1
0
mirror of https://github.com/django/django.git synced 2025-10-24 06:06:09 +00:00

Refs #18247 -- Fixed filtering on CombinedExpression(output_field=DecimalField()) annotation on SQLite.

This commit is contained in:
Sergey Fedoseev
2017-08-11 02:42:30 +05:00
committed by Tim Graham
parent 660d50805b
commit c3c6c92d76
2 changed files with 19 additions and 9 deletions

View File

@@ -244,6 +244,10 @@ class NonAggregateAnnotationTestCase(TestCase):
sum_rating=Sum('rating')
).filter(sum_rating=F('nope')))
def test_filter_decimal_annotation(self):
qs = Book.objects.annotate(new_price=F('price') + 1).filter(new_price=Decimal(31)).values_list('new_price')
self.assertEqual(qs.get(), (Decimal(31),))
def test_combined_annotation_commutative(self):
book1 = Book.objects.annotate(adjusted_rating=F('rating') + 2).get(pk=self.b1.pk)
book2 = Book.objects.annotate(adjusted_rating=2 + F('rating')).get(pk=self.b1.pk)