summary refs log tree commit diff
path: root/gnu/packages/django.scm
diff options
context:
space:
mode:
authorMarius Bakke <marius@gnu.org>2020-09-01 18:05:41 +0200
committerMarius Bakke <marius@gnu.org>2020-09-22 18:41:59 +0200
commit4f1b919156229957a686a9418a4753051f275a37 (patch)
treecdc1885be282816b66fd8cb9f314e387ae121289 /gnu/packages/django.scm
parent5bbc98a35d955571422b23aafed895ea95fe0cf0 (diff)
downloadguix-4f1b919156229957a686a9418a4753051f275a37.tar.gz
gnu: Add python-django-url-filter.
* gnu/packages/django.scm (python-django-url-filter): New public variable.
Diffstat (limited to 'gnu/packages/django.scm')
-rw-r--r--gnu/packages/django.scm47
1 files changed, 47 insertions, 0 deletions
diff --git a/gnu/packages/django.scm b/gnu/packages/django.scm
index 6953f8d0d3..f9a4a9089e 100644
--- a/gnu/packages/django.scm
+++ b/gnu/packages/django.scm
@@ -1280,3 +1280,50 @@ to ElasticSearch.")
      "This package provides mappings for the PostgreSQL @code{INET} and
 @code{CIDR} fields for use in Django projects.")
     (license license:bsd-3)))
+
+(define-public python-django-url-filter
+  (package
+    (name "python-django-url-filter")
+    (version "0.3.15")
+    (home-page "https://github.com/miki725/django-url-filter")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference (url home-page) (commit version)))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32
+                "0r4zhqhs8y6cnplwyvcb0zpijizw1ifnszs38n4w8138657f9026"))))
+    (build-system python-build-system)
+    (arguments
+     '(#:tests? #f            ;FIXME: Django raises "Apps aren't loaded yet"!?
+       #:phases (modify-phases %standard-phases
+                  (add-before 'check 'loosen-requirements
+                    (lambda _
+                      ;; Do not depend on compatibility package for old
+                      ;; Python versions.
+                      (substitute* "requirements.txt"
+                        (("enum-compat") ""))
+                      #t))
+                  (replace 'check
+                    (lambda* (#:key tests? #:allow-other-keys)
+                      (if tests?
+                          (begin
+                            (setenv "PYTHONPATH"
+                                    (string-append "./build/lib:.:"
+                                                   (getenv "PYTHONPATH")))
+                            (setenv "DJANGO_SETTINGS_MODULE"
+                                    "test_project.settings")
+                            (invoke "pytest" "-vv" "--doctest-modules"
+                                    "tests/" "url_filter/"))
+                          (format #t "test suite not run~%")))))))
+    (propagated-inputs
+     `(("python-cached-property" ,python-cached-property)
+       ("python-django" ,python-django)
+       ("python-six" ,python-six)))
+    (synopsis "Filter data via human-friendly URLs")
+    (description
+     "The main goal of Django URL Filter is to provide an easy URL interface
+for filtering data.  It allows the user to safely filter by model attributes
+and also allows to specify the lookup type for each filter (very much like
+Django's filtering system in ORM).")
+    (license license:expat)))