Opened 12 years ago

Last modified 12 years ago

#19135 closed Uncategorized

Example in "Spanning Multi-valued relationships" is mixed — at Initial Version

Reported by: anonymous Owned by: nobody
Component: Documentation Version: 1.4
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

The example writes:

That may sound a bit confusing, so hopefully an example will clarify. To select all blogs that contain entries with both "Lennon" in the headline and that were published in 2008 (the same entry satisfying both conditions), we would write:

Blog.objects.filter(entryheadlinecontains='Lennon',

entrypub_dateyear=2008)

To select all blogs that contain an entry with "Lennon" in the headline as well as an entry that was published in 2008, we would write:

Blog.objects.filter(entryheadlinecontains='Lennon').filter(

entrypub_dateyear=2008)

From my understanding, the two examples are mixed up: the first example should be for the second explanation and vice versa. First example is a union of two sets: filter(setA, setB), the second example is an intersection of two sets: filter(setA).filter(setB).

Change History (0)

Note: See TracTickets for help on using tickets.
Back to Top