From 4efb153e866c62cbac056471de62b0545a083891 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Brunner?= Date: Sat, 26 Jan 2019 22:10:13 +0100 Subject: [PATCH] Add and configure DjangoQL --- Pipfile | 1 + Pipfile.lock | 14 ++++++++++++++ requirements.txt | 1 + src/documents/admin.py | 3 ++- src/paperless/settings.py | 2 +- 5 files changed, 19 insertions(+), 2 deletions(-) diff --git a/Pipfile b/Pipfile index 47b4c8663..ccb577812 100644 --- a/Pipfile +++ b/Pipfile @@ -34,6 +34,7 @@ pytest-django = "*" pytest-sugar = "*" pytest-env = "*" pytest-xdist = "*" +djangoql = "*" [dev-packages] ipython = "*" diff --git a/Pipfile.lock b/Pipfile.lock index 5cbeecc69..c3492b434 100644 --- a/Pipfile.lock +++ b/Pipfile.lock @@ -155,6 +155,13 @@ "index": "pypi", "version": "==2.0.0" }, + "djangoql": { + "hashes": [ + "sha256:7c488ec4e3362e5389ba3c1169d1ff9a27c4222601f32c6dbf6130ce04330d76" + ], + "index": "pypi", + "version": "==0.12.3" + }, "djangorestframework": { "hashes": [ "sha256:607865b0bb1598b153793892101d881466bd5a991de12bd6229abb18b1c86136", @@ -365,6 +372,13 @@ ], "version": "==0.8.0" }, + "ply": { + "hashes": [ + "sha256:00c7c1aaa88358b9c765b6d3000c6eec0ba42abca5351b095321aef446081da3", + "sha256:096f9b8350b65ebd2fd1346b12452efe5b9607f7482813ffca50c22722a807ce" + ], + "version": "==3.11" + }, "py": { "hashes": [ "sha256:bf92637198836372b520efcba9e020c330123be8ce527e535d185ed4b6f45694", diff --git a/requirements.txt b/requirements.txt index d30cbf078..360ad310f 100755 --- a/requirements.txt +++ b/requirements.txt @@ -19,6 +19,7 @@ django==2.0.9 djangorestframework==3.9.0 docopt==0.6.2 docutils==0.14 +djangoql==0.12.3 execnet==1.5.0 factory-boy==2.11.1 faker==0.9.2 diff --git a/src/documents/admin.py b/src/documents/admin.py index ff0365a53..a7c9e828e 100644 --- a/src/documents/admin.py +++ b/src/documents/admin.py @@ -11,6 +11,7 @@ from django.utils.html import format_html, format_html_join from django.utils.http import urlquote from django.utils.safestring import mark_safe +from djangoql.admin import DjangoQLSearchMixin from documents.actions import ( add_tag_to_selected, @@ -165,7 +166,7 @@ def document_count(self, obj): document_count.admin_order_field = "document_count" -class DocumentAdmin(CommonAdmin): +class DocumentAdmin(DjangoQLSearchMixin, CommonAdmin): class Media: css = { diff --git a/src/paperless/settings.py b/src/paperless/settings.py index cb8851f62..cd12ad2f0 100644 --- a/src/paperless/settings.py +++ b/src/paperless/settings.py @@ -83,7 +83,7 @@ def __get_boolean(key, default="NO"): "rest_framework", "crispy_forms", "django_filters", - + "djangoql", ] if os.getenv("PAPERLESS_INSTALLED_APPS"):