Changeset 8185 for django/trunk/tests/modeltests/many_to_one
- Timestamp:
- 08/01/08 18:16:59 (5 months ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
django/trunk/tests/modeltests/many_to_one/models.py
r7971 r8185 47 47 # Article objects have access to their related Reporter objects. 48 48 >>> r = a.reporter 49 50 # These are strings instead of unicode strings because that's what was used in 51 # the creation of this reporter (and we haven't refreshed the data from the 52 # database, which always returns unicode strings). 49 53 >>> r.first_name, r.last_name 50 ( u'John', u'Smith')54 ('John', 'Smith') 51 55 52 56 # Create an Article via the Reporter object. … … 177 181 178 182 # You can also use a queryset instead of a literal list of instances. 179 # The queryset must be reduced to a list of values using values(), 183 # The queryset must be reduced to a list of values using values(), 180 184 # then converted into a query 181 185 >>> Article.objects.filter(reporter__in=Reporter.objects.filter(first_name='John').values('pk').query).distinct()
