#31720: Better documentation and defaults for BoolOr and BoolAnd
-------------------------------------+-------------------------------------
Reporter: Alex Scott | Owner: nobody
Type: | Status: new
Cleanup/optimization |
Component: Database layer | Version: 3.0
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 1
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Simon Charette):
> Do you think setting the default is all that needs to be done?
yeah, defining `BoolOr.output_field = models.BooleanField()` at the class
level (for `BoolAnd` as well) should be enough.
For the tests an extra method in
[https://github.com/django/django/blob/a8473b4d348776d823b7a83c1795279279cf3ab5/tests/postgres_tests/test_aggregates.py#L157
tests/postgres_tests/test_aggregates.py] for usage of `Q` objects for both
functions should be enough for each aggregate function.
e.g.
{{{#!python
def test_bool_or_q_object(self):
values =
AggregateTestModel.objects.aggregate(boolor=BoolOr(Q(integer_field__gt=2))
self.assertEqual(values, {'boolor': False})
}}}
I think examples in
[https://github.com/django/django/blob/a8473b4d348776d823b7a83c1795279279cf3ab5/docs/ref/contrib/postgres/aggregates.txt#L70-L84
the documentation] would also be welcome.
--
Ticket URL: <https://code.djangoproject.com/ticket/31720#comment:3>
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 unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/064.463f5b0d717cef4ebae65829433fad3e%40djangoproject.com.