Removed some unnecessary __exact operators in filters.

This commit is contained in:
Tim Graham 2014-01-17 17:27:04 -05:00
parent 298a2b577f
commit b87c59b04b
11 changed files with 17 additions and 17 deletions

View file

@ -101,7 +101,7 @@ You can also change a password programmatically, using
.. code-block:: python
>>> from django.contrib.auth.models import User
>>> u = User.objects.get(username__exact='john')
>>> u = User.objects.get(username='john')
>>> u.set_password('new password')
>>> u.save()

View file

@ -111,7 +111,7 @@ Create and add a ``Publication`` to an ``Article`` in one step using
Many-to-many relationships can be queried using :ref:`lookups across
relationships <lookups-that-span-relationships>`::
>>> Article.objects.filter(publications__id__exact=1)
>>> Article.objects.filter(publications__id=1)
[<Article: Django lets you build Web apps easily>, <Article: NASA uses Python>]
>>> Article.objects.filter(publications__pk=1)
[<Article: Django lets you build Web apps easily>, <Article: NASA uses Python>]
@ -143,7 +143,7 @@ The :meth:`~django.db.models.query.QuerySet.count` function respects
Reverse m2m queries are supported (i.e., starting at the table that doesn't have
a :class:`~django.db.models.ManyToManyField`)::
>>> Publication.objects.filter(id__exact=1)
>>> Publication.objects.filter(id=1)
[<Publication: The Python Journal>]
>>> Publication.objects.filter(pk=1)
[<Publication: The Python Journal>]
@ -151,7 +151,7 @@ a :class:`~django.db.models.ManyToManyField`)::
>>> Publication.objects.filter(article__headline__startswith="NASA")
[<Publication: Highlights for Children>, <Publication: Science News>, <Publication: Science Weekly>, <Publication: The Python Journal>]
>>> Publication.objects.filter(article__id__exact=1)
>>> Publication.objects.filter(article__id=1)
[<Publication: The Python Journal>]
>>> Publication.objects.filter(article__pk=1)
[<Publication: The Python Journal>]

View file

@ -123,7 +123,7 @@ This works as many levels deep as you want. There's no limit. For example::
[<Article: This is a test>]
# Find all Articles for any Reporter whose first name is "John".
>>> Article.objects.filter(reporter__first_name__exact='John')
>>> Article.objects.filter(reporter__first_name='John')
[<Article: John's second story>, <Article: This is a test>]
Exact match is implied here::
@ -134,7 +134,7 @@ Exact match is implied here::
Query twice over the related field. This translates to an AND condition in the
WHERE clause::
>>> Article.objects.filter(reporter__first_name__exact='John', reporter__last_name__exact='Smith')
>>> Article.objects.filter(reporter__first_name='John', reporter__last_name='Smith')
[<Article: John's second story>, <Article: This is a test>]
For the related lookup you can supply a primary key value or pass the related
@ -184,7 +184,7 @@ Queries can go round in circles::
[<Reporter: John Smith>, <Reporter: John Smith>, <Reporter: John Smith>, <Reporter: John Smith>]
>>> Reporter.objects.filter(article__reporter__first_name__startswith='John').distinct()
[<Reporter: John Smith>]
>>> Reporter.objects.filter(article__reporter__exact=r).distinct()
>>> Reporter.objects.filter(article__reporter=r).distinct()
[<Reporter: John Smith>]
If you delete a reporter, his articles will be deleted (assuming that the

View file

@ -113,7 +113,7 @@ This of course works in reverse::
>>> Place.objects.get(pk=1)
<Place: Demon Dogs the place>
>>> Place.objects.get(restaurant__place__exact=p1)
>>> Place.objects.get(restaurant__place=p1)
<Place: Demon Dogs the place>
>>> Place.objects.get(restaurant=r)
<Place: Demon Dogs the place>

View file

@ -411,7 +411,7 @@ can specify the field name suffixed with ``_id``. In this case, the value
parameter is expected to contain the raw value of the foreign model's primary
key. For example:
>>> Entry.objects.filter(blog_id__exact=4)
>>> Entry.objects.filter(blog_id=4)
If you pass an invalid keyword argument, a lookup function will raise
``TypeError``.
@ -489,7 +489,7 @@ want.
This example retrieves all ``Entry`` objects with a ``Blog`` whose ``name``
is ``'Beatles Blog'``::
>>> Entry.objects.filter(blog__name__exact='Beatles Blog')
>>> Entry.objects.filter(blog__name='Beatles Blog')
This spanning can be as deep as you'd like.