From 4dc3be250662b4132d8475fb02983a6d8f1eec23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anssi=20K=C3=A4=C3=A4ri=C3=A4inen?= Date: Sat, 18 Jan 2014 22:31:35 +0200 Subject: [PATCH] Fixed typos spotted by Claude Paroz --- docs/ref/models/custom-lookups.txt | 12 ++++++------ docs/releases/1.7.txt | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/docs/ref/models/custom-lookups.txt b/docs/ref/models/custom-lookups.txt index 7798e92d30..ec8aa72b38 100644 --- a/docs/ref/models/custom-lookups.txt +++ b/docs/ref/models/custom-lookups.txt @@ -88,7 +88,7 @@ application where we want to make use of the ``abs()`` operator. We have an ``Experiment`` model which records a start value, end value and the change (start - end). We would like to find all experiments where the change was equal to a certain amount (``Experiment.objects.filter(change__abs=27)``), -or where it did not exceede a certain amount +or where it did not exceed a certain amount (``Experiment.objects.filter(change__abs__lt=27)``). .. note:: @@ -113,7 +113,7 @@ Next, lets register it for ``IntegerField``:: from django.db.models import IntegerField IntegerField.register_lookup(AbsoluteValue) -We can now run the queris we had before. +We can now run the queries we had before. ``Experiment.objects.filter(change__abs=27)`` will generate the following SQL:: SELECT ... WHERE ABS("experiments"."change") = 27 @@ -184,13 +184,13 @@ transformations in Python. .. note:: In fact, most lookups with ``__abs`` could be implemented as range queries - like this, and on most database backend it is likely to be more sensible to + like this, and on most database backends it is likely to be more sensible to do so as you can make use of the indexes. However with PostgreSQL you may want to add an index on ``abs(change)`` which would allow these queries to be very efficient. -Writing alternative implemenatations for existing lookups -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Writing alternative implementations for existing lookups +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Sometimes different database vendors require different SQL for the same operation. For this example we will rewrite a custom implementation for @@ -210,7 +210,7 @@ We can change the behaviour on a specific backend by creating a subclass of Field.register_lookup(MySQLNotExact) We can then register it with ``Field``. It takes the place of the original -``NotEqual`` class as it has +``NotEqual`` class as it has the same ``lookup_name``. When compiling a query, Django first looks for ``as_%s % connection.vendor`` methods, and then falls back to ``as_sql``. The vendor names for the in-built diff --git a/docs/releases/1.7.txt b/docs/releases/1.7.txt index 0525bb2e12..b2a740f0d5 100644 --- a/docs/releases/1.7.txt +++ b/docs/releases/1.7.txt @@ -189,7 +189,7 @@ Custom lookups work just like Django's inbuilt lookups (e.g. ``lte``, The :class:`django.db.models.Lookup` class provides a way to add lookup operators for model fields. As an example it is possible to add ``day_lte`` -opertor for ``DateFields``. +operator for ``DateFields``. The :class:`django.db.models.Transform` class allows transformations of database values prior to the final lookup. For example it is possible to