mirror of
https://github.com/django/django.git
synced 2025-10-23 21:59:11 +00:00
Refs #18247 -- Fixed filtering on CombinedExpression(output_field=DecimalField()) annotation on SQLite.
This commit is contained in:
committed by
Tim Graham
parent
660d50805b
commit
c3c6c92d76
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user