#22268: Document values_list() behavior for ManyToManyField
-------------------------------------+-------------------------------------
Reporter: k_sze | Owner:
Type: | umeshksingla
Cleanup/optimization | Status: assigned
Component: Documentation | Version: master
Severity: Normal | Resolution:
Keywords: orm, values_list, | Triage Stage: Accepted
ManyToManyField |
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by psykrsna):
From the django documentation
https://docs.djangoproject.com/en/dev/ref/models/querysets/#values :
>Because ManyToManyField attributes and reverse relations can have
multiple related rows, including these can have a multiplier effect on the
size of your result set. This will be especially pronounced if you include
multiple such fields in your values() query, in which case all possible
combinations will be returned.
I believe that gives a fair amount of warning to the user as to the
behaviour of `.values()` with ManyToManyField attributes. What we can do
is:
1. Add a similar warning under the `.values_list()` reference.
2. Or modify the above warning.
The modification I am suggesting would be in the last line:
''This will be especially pronounced if you include multiple such fields
in your values() '''or values_list()''' query, in which case all possible
combinations '''(including None)''' will be returned.''
--
Ticket URL: <https://code.djangoproject.com/ticket/22268#comment:33>
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 post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/063.caa828ac6313e63fcaa19fd39a950a9a%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.