diff options
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/howto/custom-lookups.txt | 12 | ||||
| -rw-r--r-- | docs/releases/1.8.txt | 3 |
2 files changed, 15 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 diff --git a/docs/releases/1.8.txt b/docs/releases/1.8.txt index 0e42f1f12f..631b0bd2f0 100644 --- a/docs/releases/1.8.txt +++ b/docs/releases/1.8.txt @@ -299,6 +299,9 @@ Models * ``extra(select={...})`` now allows you to escape a literal ``%s`` sequence using ``%%s``. +* :doc:`Custom Lookups</howto/custom-lookups>` can now be registered using + a decorator pattern. + Signals ^^^^^^^ |
