forked from philipn/django-rest-framework-filters
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request philipn#80 from rpkilby/prevent-transform-recursion
Fix philipn#79, add transform recursion prevention
- Loading branch information
Showing
6 changed files
with
79 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
|
||
default_app_config = 'tests.testapp.apps.TestappConfig' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
|
||
from django.apps import AppConfig | ||
from django.db.models import CharField, TextField | ||
|
||
from .lookups import Unaccent | ||
|
||
|
||
class TestappConfig(AppConfig): | ||
name = 'tests.testapp' | ||
|
||
def ready(self): | ||
CharField.register_lookup(Unaccent) | ||
TextField.register_lookup(Unaccent) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
from django.db.models import Transform | ||
|
||
|
||
# This is a copy of the `Unaccent` transform from `django.contrib.postgres`. | ||
# This is necessary as the postgres app requires psycopg2 to be installed. | ||
class Unaccent(Transform): | ||
bilateral = True | ||
lookup_name = 'unaccent' | ||
function = 'UNACCENT' |