#18247: filter and Decimal equality doesn't work -------------------------------------+------------------------------------- Reporter: elmopl@… | Owner: nobody Type: Bug | Status: new Component: Database layer | Version: 1.4 (models, ORM) | Resolution: Severity: Normal | Triage Stage: Keywords: decimal filter | Unreviewed Has patch: 0 | Needs documentation: 0 Needs tests: 0 | Patch needs improvement: 0 Easy pickings: 0 | UI/UX: 0 -------------------------------------+------------------------------------- Changes (by zbyte64):
* cc: zbyte64 (added) * needs_docs: => 0 * type: Uncategorized => Bug * needs_tests: => 0 * needs_better_patch: => 0 Comment: I believe I have experienced the same issue and it only seems to apply to Django 1.4 with sqlite. {{{#!python from django.db import models class Transaction(models.Model): tag = models.CharField(max_length=5) amount = models.DecimalField(max_digits=19, decimal_places=4) def test_transaction(): Transaction.objects.all().delete() Transaction.objects.create(amount=5, tag='a') Transaction.objects.create(amount=4, tag='a') Transaction.objects.create(amount=1, tag='b') Transaction.objects.create(amount='1.5', tag='b') Transaction.objects.create(amount=1, tag='c') qs = Transaction.objects.values('tag').annotate(sumamount=models.Sum('amount')) print qs #displays 3 results qs = Transaction.objects.values('tag').annotate(sumamount=models.Sum('amount')).filter(sumamount__gt=3) print qs #displays 0 results when using sqlite + Django 1.4, displays 1 result when using mysql or Django 1.3.1 }}} -- Ticket URL: <https://code.djangoproject.com/ticket/18247#comment:1> Django <https://code.djangoproject.com/> The Web framework for perfectionists with deadlines. -- You received this message because you are subscribed to the Google Groups "Django updates" group. To post to this group, send email to django-updates@googlegroups.com. To unsubscribe from this group, send email to django-updates+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-updates?hl=en.