summaryrefslogtreecommitdiff
path: root/docs/howto
diff options
context:
space:
mode:
authorMarc Tamlyn <marc.tamlyn@gmail.com>2014-10-09 17:04:50 +0100
committerMarc Tamlyn <marc.tamlyn@gmail.com>2014-10-09 18:44:58 +0100
commit92a17eaae081a213171b044858d6fc29df2df733 (patch)
treeeae95057cfb26745d2bd99dba63811aae6d5db8e /docs/howto
parentd6a87eefd87250e68457488cfd62fb2cc8211b24 (diff)
Fixed #23627 -- Allowed register_lookup to work as a decorator.
Diffstat (limited to 'docs/howto')
-rw-r--r--docs/howto/custom-lookups.txt12
1 files changed, 12 insertions, 0 deletions
diff --git a/docs/howto/custom-lookups.txt b/docs/howto/custom-lookups.txt
index c02b896071..820a2ef574 100644
--- a/docs/howto/custom-lookups.txt
+++ b/docs/howto/custom-lookups.txt
@@ -46,6 +46,18 @@ it with ``Field`` directly::
from django.db.models.fields import Field
Field.register_lookup(NotEqual)
+Lookup registration can also be done using a decorator pattern::
+
+ from django.db.models.fields import Field
+
+ @Field.registerLookup
+ class NotEqualLookup(Lookup):
+ # ...
+
+.. versionchanged:: 1.8
+
+ The ability to use the decorator pattern was added.
+
We can now use ``foo__ne`` for any field ``foo``. You will need to ensure that
this registration happens before you try to create any querysets using it. You
could place the implementation in a ``models.py`` file, or register the lookup