Changes between Initial Version and Version 2 of Ticket #19135
- Timestamp:
- Oct 17, 2012, 2:52:32 AM (12 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #19135
- Property Resolution → invalid
- Property Status new → closed
-
Ticket #19135 – Description
initial v2 2 2 3 3 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: 4 4 {{{ 5 5 Blog.objects.filter(entry__headline__contains='Lennon', 6 6 entry__pub_date__year=2008) 7 7 }}} 8 8 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: 9 9 {{{ 10 10 Blog.objects.filter(entry__headline__contains='Lennon').filter( 11 11 entry__pub_date__year=2008) 12 12 }}} 13 13 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).