#26379: Document that first filter() chained to a RelatedManager is sticky
-------------------------------------+-------------------------------------
Reporter: Balázs Oroszi | Owner: Annabelle
| Wiegart
Type: Bug | Status: assigned
Component: Documentation | Version: 1.9
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Annabelle Wiegart):
Just to be sure: The filter behaviour to be documented refers to a
ManyToMany relationship with an explicit through model, like Subscription
in the above example. Is that correct?
I was thinking to enhance the example in
https://docs.djangoproject.com/en/5.2/topics/db/queries/ like so:
{{{
class Entry(models.Model):
...
authors = models.ManyToManyField(Author, through="Contribution")
class Contribution(models.Model):
RELATION_CHOICES = {
"aut": "author",
"edt": "editor",
"ill": "illustrator",
}
person = models.ForeignKey(Author, on_delete=models.CASCADE)
entry = models.ForeignKey(Entry, on_delete=models.CASCADE)
relation = models.CharField(max_length=3, choices=RELATION_CHOICES,
default="aut")
}}}
And then use a query example that filters based on the relation attribute
of Contribution. Is that going in the right direction? (I'm currently
figuring out the details.)
--
Ticket URL: <https://code.djangoproject.com/ticket/26379#comment:13>
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 visit
https://groups.google.com/d/msgid/django-updates/0107019a549d2f4f-0bb681fa-1530-4a39-98a6-488717682b10-000000%40eu-central-1.amazonses.com.