gnu: r-opencyto: Update to 2.8.4.
[jackhill/guix/guix.git] / gnu / packages / django.scm
index e962e87..d73a1bb 100644 (file)
@@ -6,7 +6,10 @@
 ;;; Copyright © 2017 Ricardo Wurmus <rekado@elephly.net>
 ;;; Copyright © 2018 Vijayalakshmi Vedantham <vijimay12@gmail.com>
 ;;; Copyright © 2019 Sam <smbaines8@gmail.com>
-;;; Copyright © 2020, 2021 Marius Bakke <marius@gnu.org>
+;;; Copyright © 2020, 2021, 2022 Marius Bakke <marius@gnu.org>
+;;; Copyright © 2021 Maxim Cournoyer <maxim.cournoyer@gmail.com>
+;;; Copyright © 2021 Luis Felipe López Acevedo <luis.felipe.la@protonmail.com>
+;;; Copyright © 2022 Pradana Aumars <paumars@courrier.dev>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
   #:use-module (guix packages)
   #:use-module (guix download)
   #:use-module (guix git-download)
+  #:use-module (guix gexp)
   #:use-module (guix build-system python)
+  #:use-module (guix deprecation)
   #:use-module (gnu packages)
   #:use-module (gnu packages base)
+  #:use-module (gnu packages compression)
   #:use-module (gnu packages databases)
   #:use-module (gnu packages check)
+  #:use-module (gnu packages finance)
   #:use-module (gnu packages geo)
   #:use-module (gnu packages openldap)
   #:use-module (gnu packages python)
-  #:use-module (gnu packages python-compression)
+  #:use-module (gnu packages python-build)
+  #:use-module (gnu packages python-check)
   #:use-module (gnu packages python-crypto)
   #:use-module (gnu packages python-web)
   #:use-module (gnu packages python-xyz)
   #:use-module (gnu packages time)
   #:use-module (gnu packages xml))
 
-(define-public python-django
+(define-public python-django-4.0
   (package
     (name "python-django")
-    (version "3.2.2")
+    (version "4.0.7")
     (source (origin
               (method url-fetch)
               (uri (pypi-uri "Django" version))
               (sha256
                (base32
-                "0gffaabnnpzj0sl3jl7mllvi3gc0jvab6xw2bckvyljwsrd1j78a"))))
+                "0qblhh7s7fcznqr79919yp2d7wiz3ixv39navmifb677dg9mlvcw"))))
     (build-system python-build-system)
     (arguments
      '(#:phases
@@ -63,8 +71,7 @@
              ;; The test-suite tests timezone-dependent functions, thus tzdata
              ;; needs to be available.
              (setenv "TZDIR"
-                     (string-append (assoc-ref inputs "tzdata")
-                                    "/share/zoneinfo"))
+                     (search-input-directory inputs "share/zoneinfo"))
 
              ;; Disable test for incorrect timezone: it only raises the
              ;; expected error when /usr/share/zoneinfo exists, even though
              (substitute* "tests/settings_tests/tests.py"
                ((".*def test_incorrect_timezone.*" all)
                 (string-append "    @unittest.skipIf(True, 'Disabled by Guix')\n"
-                               all)))
-
-             ;; Preserve the PYTHONPATH created by Guix when running the tests.
-             (substitute* "tests/admin_scripts/tests.py"
-               (("python_path = \\[")
-                (string-append "python_path = ['"
-                               (string-join
-                                (string-split (getenv "PYTHONPATH") #\:)
-                                "','")
-                               "', ")))
-
-             #t))
+                               all)))))
          (replace 'check
            (lambda* (#:key tests? #:allow-other-keys)
              (if tests?
                  (with-directory-excursion "tests"
-                   (setenv "PYTHONPATH"
-                           (string-append "..:" (getenv "PYTHONPATH")))
+                   ;; Tests expect PYTHONPATH to contain the root directory.
+                   (setenv "PYTHONPATH" "..")
                    (invoke "python" "runtests.py"
                            ;; By default tests run in parallel, which may cause
                            ;; various race conditions.  Run sequentially for
          (delete 'wrap))))
     ;; TODO: Install extras/django_bash_completion.
     (native-inputs
-     `(("tzdata" ,tzdata-for-tests)
-       ;; Remaining packages are test requirements taken from
-       ;; tests/requirements/py3.txt
-       ("python-docutils" ,python-docutils)
-       ;; optional for tests: ("python-geoip2" ,python-geoip2)
-       ;; optional for tests: ("python-memcached" ,python-memcached)
-       ("python-numpy" ,python-numpy)
-       ("python-pillow" ,python-pillow)
-       ("python-pyyaml" ,python-pyyaml)
-       ;; optional for tests: ("python-selenium" ,python-selenium)
-       ("python-tblib" ,python-tblib)))
+     (list tzdata-for-tests
+           ;; Remaining packages are test requirements taken from
+           ;; tests/requirements/py3.txt
+           python-docutils
+           ;; optional for tests: ("python-geoip2" ,python-geoip2)
+           ;; optional for tests: ("python-memcached" ,python-memcached)
+           python-numpy
+           python-pillow
+           python-pyyaml
+           ;; optional for tests: ("python-selenium" ,python-selenium)
+           python-tblib))
     (propagated-inputs
-     `(("python-asgiref" ,python-asgiref)
-       ("python-pytz" ,python-pytz)
-       ("python-sqlparse" ,python-sqlparse)
-
-       ;; Optional dependencies.
-       ("python-argon2-cffi" ,python-argon2-cffi)
-       ("python-bcrypt" ,python-bcrypt)
-
-       ;; This input is not strictly required, but in practice many Django
-       ;; libraries need it for test suites and similar.
-       ("python-jinja2" ,python-jinja2)))
+     (list python-asgiref
+           python-sqlparse
+           ;; Optional dependencies.
+           python-argon2-cffi
+           python-bcrypt
+           ;; This input is not strictly required, but in practice many Django
+           ;; libraries need it for test suites and similar.
+           python-jinja2))
+    (native-search-paths
+     ;; Set TZDIR when 'tzdata' is available so that timezone functionality
+     ;; works (mostly) out of the box in containerized environments.
+     ;; Note: This search path actually belongs to 'glibc'.
+     (list (search-path-specification
+            (variable "TZDIR")
+            (files '("share/zoneinfo")))))
     (home-page "https://www.djangoproject.com/")
     (synopsis "High-level Python Web framework")
     (description
@@ -139,20 +139,55 @@ to the @dfn{don't repeat yourself} (DRY) principle.")
     (license license:bsd-3)
     (properties `((cpe-name . "django")))))
 
+(define-public python-django-3.2
+  (package
+    (inherit python-django-4.0)
+    (version "3.2.15")
+    (source (origin
+              (method url-fetch)
+              (uri (pypi-uri "Django" version))
+              (sha256
+               (base32
+                "0asqhsw73555wjnvd7769b89q9w96q2k95mcr634mw92m2qk86gp"))))
+    (native-search-paths '())           ;no need for TZDIR
+    (propagated-inputs
+     (modify-inputs (package-propagated-inputs python-django-4.0)
+       ;; Django 4.0 deprecated pytz in favor of Pythons built-in zoneinfo.
+       (append python-pytz)))))
+
+;; archivebox requires django>=3.1.3,<3.2
+(define-public python-django-3.1.14
+  (package
+    (inherit python-django-3.2)
+    (version "3.1.14")
+    (source (origin
+              (method url-fetch)
+              (uri (pypi-uri "Django" version))
+              (sha256
+               (base32
+                "0ix3v2wlnplv78zxjrlw8z3hiap2d5mxvk0ny2fc65526shsb93j"))))
+    (propagated-inputs
+     (modify-inputs (package-propagated-inputs python-django-3.2)
+       ;; Django 4.0 deprecated pytz in favor of Pythons built-in zoneinfo.
+       (append python-pytz)))))
+
 (define-public python-django-2.2
   (package
-    (inherit python-django)
-    (version "2.2.20")
+    (inherit python-django-3.2)
+    (version "2.2.28")
     (source (origin
               (method url-fetch)
               (uri (pypi-uri "Django" version))
               (sha256
                (base32
-                "0r3a6gbhwngxl172yy6n0sq5knibl2vxc0wbk1g8licfbzfgjs95"))))
+                "04vl7aivsshzsnn547lm4jdinr67afhdspc40f0c06xzmxbvc002"))))
     (native-inputs
-     `(;; XXX: In 2.2 and 3.0, selenium is required for the test suite.
-       ("python-selenium" ,python-selenium)
-       ,@(package-native-inputs python-django)))))
+     (modify-inputs (package-native-inputs python-django-3.2)
+       (prepend ;; 2.2 requires Selenium for the test suite.
+                python-selenium)))))
+
+;; Use 3.2 LTS as the default until packages gain support for 4.x.
+(define-public python-django python-django-3.2)
 
 (define-public python-django-extensions
   (package
@@ -173,19 +208,16 @@ to the @dfn{don't repeat yourself} (DRY) principle.")
     (arguments
      '(#:tests? #f)) ;XXX: requires a Postgres or MySQL database
     (propagated-inputs
-     `(("python-six" ,python-six)
-       ("python-vobject" ,python-vobject)
-       ("python-werkzeug" ,python-werkzeug)
-       ("python-dateutil" ,python-dateutil)))
+     (list python-six python-vobject python-werkzeug python-dateutil
+           python-django))
     (native-inputs
-     `(("python-django" ,python-django)
-       ("python-mock" ,python-mock)
-       ("python-factory-boy" ,python-factory-boy)
-       ("python-tox" ,python-tox)
-       ("python-pytest" ,python-pytest)
-       ("python-pytest-cov" ,python-pytest-cov)
-       ("python-pytest-django" ,python-pytest-django)
-       ("python-shortuuid" , python-shortuuid)))
+     (list python-mock
+           python-factory-boy
+           python-tox
+           python-pytest
+           python-pytest-cov
+           python-pytest-django
+           python-shortuuid))
     (home-page
      "https://github.com/django-extensions/django-extensions")
     (synopsis "Custom management extensions for Django")
@@ -194,6 +226,38 @@ to the @dfn{don't repeat yourself} (DRY) principle.")
 commands, additional database fields and admin extensions.")
     (license license:expat)))
 
+(define-public python-django-localflavor
+  (package
+    (name "python-django-localflavor")
+    (version "3.1")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (pypi-uri "django-localflavor" version))
+       (sha256
+        (base32 "0i1s0ijfd9rv2cp5x174jcyjpwn7fyg7s1wpbvlwm96bpdvs6bxc"))))
+    (build-system python-build-system)
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (replace 'check
+           (lambda* (#:key inputs outputs tests? #:allow-other-keys)
+             (when tests?
+               (add-installed-pythonpath inputs outputs)
+               (setenv "PYTHONPATH"
+                       (string-append ".:"
+                                      (getenv "GUIX_PYTHONPATH")))
+               (invoke "invoke" "test")))))))
+    (native-inputs
+     (list python-coverage python-invoke python-pytest-django which))
+    (propagated-inputs
+     (list python-django python-stdnum))
+    (home-page "https://django-localflavor.readthedocs.io/en/latest/")
+    (synopsis "Country-specific Django helpers")
+    (description "Django-LocalFlavor is a collection of assorted pieces of code
+that are useful for particular countries or cultures.")
+    (license license:bsd-3)))
+
 (define-public python-django-simple-math-captcha
   (package
     (name "python-django-simple-math-captcha")
@@ -224,10 +288,9 @@ commands, additional database fields and admin extensions.")
                     (lambda _
                       (invoke "python" "runtests.py"))))))
     (native-inputs
-     `(("python-django" ,python-django)
-       ("python-mock" ,python-mock)))
+     (list python-mock))
     (propagated-inputs
-     `(("python-six" ,python-six)))
+     (list python-django python-six))
     (synopsis "Easy-to-use math field/widget captcha for Django forms")
     (description
      "A multi-value-field that presents a human answerable question,
@@ -249,6 +312,8 @@ with arguments to the field constructor.")
     (build-system python-build-system)
     ;; FIXME: How to make the test templates available to Django?
     (arguments '(#:tests? #f))
+    (propagated-inputs
+     (list python-django))
     (home-page "https://github.com/divio/django-classy-tags")
     (synopsis "Class based template tags for Django")
     (description
@@ -277,11 +342,9 @@ when coding custom template tags.")
            (lambda _
              (invoke "python3" "-m" "django" "test" "--settings=tests.settings"))))))
     (propagated-inputs
-     `(("python-isort" ,python-isort)))
+     (list python-django python-isort))
     (native-inputs
-     `(("python-django" ,python-django)
-       ("python-pytest" ,python-pytest)
-       ("python-mock" ,python-mock)))
+     (list python-pytest python-mock))
     (home-page
      "https://github.com/jazzband/django-taggit")
     (synopsis
@@ -302,10 +365,8 @@ when coding custom template tags.")
         (base32
          "14gzp5cv24z0qhxb7f7k7v9jgzpaj4n8yhjq83ynpx8183fs1rz4"))))
     (build-system python-build-system)
-    (native-inputs
-     `(("python-django" ,python-django)))
     (propagated-inputs
-     `(("python-pillow" ,python-pillow)))
+     (list python-django python-pillow))
     (home-page "https://github.com/SmileyChris/easy-thumbnails")
     (synopsis "Easy thumbnails for Django")
     (description
@@ -318,45 +379,41 @@ size and quality.")
 (define-public python-pytest-django
   (package
     (name "python-pytest-django")
-    (version "3.10.0")
+    (version "4.4.0")
     (source (origin
               (method url-fetch)
               (uri (pypi-uri "pytest-django" version))
               (sha256
                (base32
-                "19nvqsb7b9kz3ikpb50m8ppf7mfhzrapdxsqd5hhd1pdfz8dprjd"))))
+                "0mglnz0w6k7dgw1jn6giv56pmdjd6a3zwwkhxb2kyzmzk0viw5xm"))))
     (build-system python-build-system)
     (arguments
-     `(#:phases
+     ;; The test suite is disabled because there are many test failures (see:
+     ;; https://github.com/pytest-dev/pytest-django/issues/943).
+     `(#:tests? #f
+       #:phases
        (modify-phases %standard-phases
          (replace 'check
            (lambda* (#:key tests? inputs outputs #:allow-other-keys)
              (if tests?
-                 (begin
-                   (add-installed-pythonpath inputs outputs)
-                   (setenv "PYTHONPATH"
-                           (string-append ".:" ;for pytest_django_test
-                                          (getenv "PYTHONPATH")))
-                   (setenv "PYTEST_DJANGO_TEST_RUNNER" "pytest")
-                   (setenv "DJANGO_SETTINGS_MODULE"
-                           "pytest_django_test.settings_sqlite_file")
-                   (invoke "pytest" "-vv" "-k"
-                           ;; FIXME: these tests fail to locate Django templates ...
-                           (string-append "not test_django_not_loaded_without_settings"
-                                          " and not test_settings"
-                                          ;; ... and this does not discover
-                                          ;; 'pytest_django_test'.
-                                          " and not test_urls_cache_is_cleared")))
-                 (format #t "test suite not run~%"))
-             #t)))))
+               (begin
+                 (setenv "PYTEST_DJANGO_TEST_RUNNER" "pytest")
+                 (setenv "DJANGO_SETTINGS_MODULE"
+                         "pytest_django_test.settings_sqlite_file")
+                 (invoke "python" "-m" "pytest" "-vv" "-k"
+                         ;; FIXME: these tests fail to locate Django templates ...
+                         (string-append "not test_django_not_loaded_without_settings"
+                                        " and not test_settings"
+                                        ;; ... and this does not discover
+                                        ;; 'pytest_django_test'.
+                                        " and not test_urls_cache_is_cleared")))
+               (format #t "test suite not run~%")))))))
     (native-inputs
-     `(("python-django" ,python-django)
-       ("python-setuptools-scm" ,python-setuptools-scm)
-
-       ;; For tests.
-       ("python-pytest-xdist" ,python-pytest-xdist)))
+     (list python-django python-setuptools-scm
+           ;; For tests.
+           python-pytest-xdist-next))
     (propagated-inputs
-     `(("python-pytest" ,python-pytest-6)))
+     (list python-pytest))
     (home-page "https://pytest-django.readthedocs.org/")
     (synopsis "Django plugin for py.test")
     (description "Pytest-django is a plugin for py.test that provides a set of
@@ -366,14 +423,14 @@ useful tools for testing Django applications and projects.")
 (define-public python-django-haystack
   (package
     (name "python-django-haystack")
-    (version "2.8.1")
+    (version "3.1.1")
     (source
       (origin
         (method url-fetch)
         (uri (pypi-uri "django-haystack" version))
         (sha256
          (base32
-          "1302fqsrx8w474xk5cmnmg3hjqfprlxnjg9qlg86arsr4v4vqm4b"))))
+          "10kaa5641cakpra2x3jqgys085gdkjcyns26plfyrmfpjmmpa1bd"))))
     (build-system python-build-system)
     (arguments
      '(#:phases
@@ -381,27 +438,28 @@ useful tools for testing Django applications and projects.")
          (add-after 'unpack 'loosen-verion-restrictions
            (lambda _
              (substitute* "setup.py"
-               (("geopy.*") "geopy',\n"))
-             #t))
+               (("geopy.*") "geopy\",\n"))))
          (add-before 'check 'set-gdal-lib-path
            (lambda* (#:key inputs #:allow-other-keys)
              (setenv "GDAL_LIBRARY_PATH"
                      (string-append (assoc-ref inputs "gdal")
-                                    "/lib"))
-             #t)))
+                                    "/lib"))))
+         ;; Importing this module requires setting up a Django project.
+         (delete 'sanity-check))
        #:tests? #f)) ; OSError: libgdal.so.27: cannot open shared object file
+    (propagated-inputs
+     (list python-django))
     (native-inputs
-     `(("gdal" ,gdal)
-       ("python-coverage" ,python-coverage)
-       ("python-django" ,python-django)
-       ("python-dateutil" ,python-dateutil)
-       ("python-geopy" ,python-geopy)
-       ("python-mock" ,python-mock)
-       ("python-nose" ,python-nose)
-       ("python-requests" ,python-requests)
-       ("python-setuptools-scm" ,python-setuptools-scm)
-       ("python-pysolr" ,python-pysolr)
-       ("python-whoosh" ,python-whoosh)))
+     (list gdal
+           python-coverage
+           python-dateutil
+           python-geopy
+           python-mock
+           python-nose
+           python-requests
+           python-setuptools-scm
+           python-pysolr
+           python-whoosh))
     (home-page "http://haystacksearch.org/")
     (synopsis "Pluggable search for Django")
     (description "Haystack provides modular search for Django.  It features a
@@ -428,10 +486,8 @@ your code.")
            (lambda _
              (invoke "python" "runtests.py"))))))
     (native-inputs
-     `(("python-django" ,python-django)
-       ("python-djangorestframework" ,python-djangorestframework)
-       ("python-django-crispy-forms" ,python-django-crispy-forms)
-       ("python-mock" ,python-mock)))
+     (list python-django python-django-rest-framework
+           python-django-crispy-forms python-mock))
     (home-page "https://django-filter.readthedocs.io/en/latest/")
     (synopsis "Reusable Django application to filter querysets dynamically")
     (description
@@ -462,12 +518,11 @@ them do this.")
              (invoke "django-admin" "test" "allauth.tests"
                      "--pythonpath=."))))))
     (propagated-inputs
-     `(("python-openid" ,python-openid)
-       ("python-requests" ,python-requests)
-       ("python-requests-oauthlib" ,python-requests-oauthlib)))
+     (list python-openid python-requests python-requests-oauthlib))
     (native-inputs
-     `(("python-django" ,python-django)
-       ("python-mock" ,python-mock)))
+     (list python-mock))
+    (inputs
+     (list python-django))
     (home-page "https://github.com/pennersr/django-allauth")
     (synopsis "Set of Django applications addressing authentication")
     (description
@@ -492,11 +547,9 @@ account authentication.")
          "1m1j2sx7q0blma0miswj3c8hrfi5q4y5cq2b816v8gagy89xgc57"))))
     (build-system python-build-system)
     (propagated-inputs
-     `(("python-sqlparse" ,python-sqlparse)))
+     (list python-sqlparse python-django))
     (native-inputs
-     `(("python-django" ,python-django)
-       ("python-django-jinja" ,python-django-jinja)
-       ("python-html5lib" ,python-html5lib)))
+     (list python-django-jinja python-html5lib))
     (arguments
      '(#:phases
        (modify-phases %standard-phases
@@ -525,10 +578,8 @@ request and response as a toolbar on the rendered page.")
     (build-system python-build-system)
     (arguments '(#:tests? #f))          ;XXX: 'make check' does "echo TODO"
     (propagated-inputs
-     `(("python-django-debug-toolbar" ,python-django-debug-toolbar)
-       ("python-jsonplus" ,python-jsonplus)
-       ("python-six" ,python-six)
-       ("python-sqlalchemy" ,python-sqlalchemy)))
+     (list python-django python-django-debug-toolbar python-jsonplus
+           python-six python-sqlalchemy))
     (synopsis "Django Debug Toolbar panel for SQLAlchemy")
     (description
      "This package completely mimics the default Django Debug Toolbar SQL
@@ -552,7 +603,7 @@ queries done via the Django ORM, SQLAlchemy generated queries are displayed.")
      '(;; TODO: The django project for the tests is missing from the release.
        #:tests? #f))
     (inputs
-     `(("python-django" ,python-django)))
+     (list python-django))
     (home-page "https://github.com/twaddington/django-gravatar")
     (synopsis "Gravatar support for Django, improved version")
     (description
@@ -572,10 +623,9 @@ templatetags and a full test suite.")
                 "0fc6i77faxxv1gjlp06lv3kw64b5bhdiypaygfxh5djddgk83fwa"))))
     (build-system python-build-system)
     (native-inputs
-     `(("python-django" ,python-django)
-       ("python-nose" ,python-nose)))
+     (list python-nose))
     (propagated-inputs
-     `(("python-webassets" ,python-webassets)))
+     (list python-django python-webassets))
     (home-page "https://github.com/miracle2k/django-assets")
     (synopsis "Asset management for Django")
     (description
@@ -587,7 +637,7 @@ merging, minifying and compiling CSS and Javascript files.")
 (define-public python-django-jinja
   (package
     (name "python-django-jinja")
-    (version "2.6.0")
+    (version "2.9.1")
     (source
      (origin
        (method git-fetch)
@@ -597,12 +647,10 @@ merging, minifying and compiling CSS and Javascript files.")
        (file-name (git-file-name name version))
        (sha256
         (base32
-         "06ldbkfkm6sc0p9sqpjph06gxrqpj78ih3dc2yik2fcba2y5mak1"))))
+         "0p9pkn6jjzagpnvcrl9c2vjqamkms7ymvyhhmaqqqhrlv89qnzp7"))))
     (build-system python-build-system)
     (propagated-inputs
-     `(("python-jinja2" ,python-jinja2)
-       ("python-pytz" ,python-pytz)
-       ("python-django-pipeline" ,python-django-pipeline)))
+     (list python-django python-jinja2 python-pytz python-django-pipeline))
     (arguments
      '(;; TODO Tests currently fail due to issues with the configuration for
        ;; django-pipeline
@@ -624,10 +672,6 @@ provides certain advantages over the builtin Jinja2 backend in Django, for
 example, explicit calls to callables from templates and better performance.")
     (license license:bsd-3)))
 
-;; JSONField is now built-in to Django, obsoleting this package.
-(define-public python-django-jsonfield
-  (deprecated-package "python-django-jsonfield" python-django))
-
 (define-public python-dj-database-url
   (package
     (name "python-dj-database-url")
@@ -673,7 +717,7 @@ conn_max_age argument to easily enable Django’s connection pool.")
                     (lambda _
                       (invoke "python" "-m" "django" "test" "-v2"
                               "--settings=tests.settings"))))))
-    (native-inputs
+    (propagated-inputs
      ;; XXX: Picklefield has not been updated in 10+ years and fails tests
      ;; with Django 3.2.
      `(("python-django@2.2" ,python-django-2.2)))
@@ -695,6 +739,8 @@ conn_max_age argument to easily enable Django’s connection pool.")
     (arguments
      ;; XXX: Tests require a Postgres database.
      `(#:tests? #f))
+    (propagated-inputs
+     (list python-django))
     (home-page "https://github.com/aykut/django-bulk-update")
     (synopsis "Simple bulk update over Django ORM or with helper function")
     (description
@@ -705,27 +751,25 @@ project aims to bulk update given objects using one query over Django ORM.")
 (define-public python-django-contact-form
   (package
     (name "python-django-contact-form")
-    (version "1.8.1")
+    (version "1.9")
     (source (origin
               (method url-fetch)
               (uri (pypi-uri "django-contact-form" version))
               (sha256
                (base32
-                "1zv7bcjfrg32gcsq3bclkld79l6mcy2wcvlj81h7q2ppv1wm8vqs"))))
+                "1my9hkrylckp5vfqg9b0kncrdlxjnwxll56sdciqn4v19i4wbq1y"))))
     (build-system python-build-system)
     (arguments
      `(#:phases
        (modify-phases %standard-phases
          (replace 'check
            (lambda _
-             (setenv "PYTHONPATH"
-                     (string-append "./build/lib:"
-                                    (getenv "PYTHONPATH")))
              (invoke "coverage" "run" "--source" "contact_form"
                      "runtests.py"))))))
     (native-inputs
-     `(("python-coverage" ,python-coverage)
-       ("python-django" ,python-django)))
+     (list python-coverage))
+    (propagated-inputs
+     (list python-django))
     (home-page "https://github.com/ubernostrum/django-contact-form")
     (synopsis "Contact form for Django")
     (description
@@ -744,10 +788,8 @@ for Django sites.")
                (base32
                 "0ccdiv784a5vnpfal36km4dyg12340rwhpr0riyy0k89wfnjn8yi"))))
     (build-system python-build-system)
-    (native-inputs
-     `(("python-django" ,python-django)))
     (propagated-inputs
-     `(("python-six" ,python-six)))
+     (list python-django python-six))
     (home-page "https://github.com/django/django-contrib-comments")
     (synopsis "Comments framework")
     (description
@@ -779,20 +821,13 @@ entries, photos, book chapters, or anything else.")
                 (which "env")))))
          (replace 'check
            (lambda*(#:key tests? #:allow-other-keys)
-             (or
-              (not tests?)
-              (begin
-                (setenv "PYTHONPATH"
-                        (string-append (getcwd) ":"
-                                       (getenv "PYTHONPATH")))
-                (setenv "DJANGO_SETTINGS_MODULE" "tests.settings")
-                (invoke "django-admin" "test" "tests"))))))))
-    (native-inputs
-     `(("python-django" ,python-django)))
+             (when tests?
+               (setenv "DJANGO_SETTINGS_MODULE" "tests.settings")
+               (invoke "django-admin" "test" "tests"
+                       "--pythonpath=.")))))))
     (propagated-inputs
-     `(("python-css-html-js-minify" ,python-css-html-js-minify)
-       ("python-slimit" ,python-slimit)
-       ("python-jsmin" ,python-jsmin)))
+     (list python-css-html-js-minify python-django python-slimit
+           python-jsmin))
     (home-page
      "https://github.com/jazzband/django-pipeline")
     (synopsis "Asset packaging library for Django")
@@ -822,14 +857,10 @@ support, and optional data-URI image and font embedding.")
              (with-directory-excursion "tests"
                (invoke "python" "runtests.py")))))))
     (native-inputs
-     `(("python-django" ,python-django)
-       ("python-fakeredis" ,python-fakeredis)
-       ("python-hiredis" ,python-hiredis)
-       ("python-mock" ,python-mock)
-       ("python-msgpack" ,python-msgpack)
-       ("redis" ,redis)))
+     (list python-fakeredis python-hiredis python-mock python-msgpack
+           redis))
     (propagated-inputs
-     `(("python-redis" ,python-redis)))
+     (list python-django python-redis))
     (home-page "https://github.com/niwibe/django-redis")
     (synopsis "Full featured redis cache backend for Django")
     (description
@@ -857,13 +888,9 @@ support, and optional data-URI image and font embedding.")
                      "--settings=django_rq.tests.settings"
                      "--pythonpath=."))))))
     (native-inputs
-     `(("python-django" ,python-django)
-       ("python-django-redis" ,python-django-redis)
-       ("python-mock" ,python-mock)
-       ("python-rq-scheduler" ,python-rq-scheduler)
-       ("redis" ,redis)))
+     (list python-django-redis python-mock python-rq-scheduler redis))
     (propagated-inputs
-     `(("python-rq" ,python-rq)))
+     (list python-django python-rq))
     (home-page "https://github.com/ui/django-rq")
     (synopsis "Django integration with RQ")
     (description
@@ -885,12 +912,9 @@ settings.py and easily use them in your project.")
     (build-system python-build-system)
     ;; FIXME: Tests require disque, Redis, MongoDB, Docker.
     (arguments '(#:tests? #f))
-    (native-inputs
-     `(("python-django" ,python-django)))
     (propagated-inputs
-     `(("python-arrow" ,python-arrow)
-       ("python-blessed" ,python-blessed)
-       ("python-django-picklefield" ,python-django-picklefield)))
+     (list python-arrow python-blessed python-django
+           python-django-picklefield))
     (home-page "https://django-q.readthedocs.io/")
     (synopsis "Multiprocessing distributed task queue for Django")
     (description
@@ -913,12 +937,11 @@ using Python multiprocessing.")
      `(#:phases (modify-phases %standard-phases
                   (replace 'check
                     (lambda _
-                      (setenv "PYTHONPATH" (string-append "./test_project:"
-                                                          "./build/lib:.:"
-                                                          (getenv "PYTHONPATH")))
-                      (invoke "django-admin.py" "test" "--settings=settings"))))))
-    (native-inputs
-     `(("python-django" ,python-django)))
+                      (invoke "django-admin"
+                              "test" "--settings=test_project.settings"
+                              "--pythonpath=."))))))
+    (propagated-inputs
+     (list python-django))
     (home-page "https://github.com/jazzband/django-sortedm2m")
     (synopsis "Drop-in replacement for django's own ManyToManyField")
     (description
@@ -942,12 +965,10 @@ the order of added relations.")
      '(#:phases (modify-phases %standard-phases
                   (replace 'check
                     (lambda _
-                      (setenv "PYTHONPATH" (string-append ".:"
-                                                          (getenv "PYTHONPATH")))
                       (setenv "DJANGO_SETTINGS_MODULE" "tests.test_settings")
-                      (invoke "django-admin.py" "test" "-v2"))))))
-    (native-inputs
-     `(("python-django" ,python-django)))
+                      (invoke "django-admin" "test" "--pythonpath=."))))))
+    (propagated-inputs
+     (list python-django))
     (home-page "https://github.com/django-compressor/django-appconf")
     (synopsis "Handle configuration defaults of packaged Django apps")
     (description
@@ -961,7 +982,7 @@ name is purely coincidental.")
 (define-public python-django-statici18n
   (package
     (name "python-django-statici18n")
-    (version "1.9.0")
+    (version "2.1.0")
     (home-page "https://github.com/zyegfryed/django-statici18n")
     (source (origin
               (method git-fetch)
@@ -971,23 +992,20 @@ name is purely coincidental.")
               (file-name (git-file-name name version))
               (sha256
                (base32
-                "1p3myp2im6c87yc05alh91jyahqws5lcw3zzdsj4dh8lx9s9cgpf"))))
+                "0x0xvfqd40is2ks43d65awgqkx3wk10lvdim15scvbjhkh301b6v"))))
     (build-system python-build-system)
     (arguments
      '(#:phases (modify-phases %standard-phases
                   (replace 'check
                     (lambda _
-                      (setenv "PYTHONPATH"
-                              (string-append "./tests/test_project:./build/lib:"
-                                             (getenv "PYTHONPATH")))
+                      (setenv "PYTHONPATH" "./tests/test_project")
                       (setenv "DJANGO_SETTINGS_MODULE" "project.settings")
                       (invoke "pytest" "-vv"))))))
     (native-inputs
-     `(("python-django" ,python-django)
-       ("python-pytest" ,python-pytest)
-       ("python-pytest-django" ,python-pytest-django)))
+     (list python-pytest python-pytest-django))
     (propagated-inputs
-     `(("django-appconf" ,python-django-appconf)))
+     `(("python-django" ,python-django)
+       ("django-appconf" ,python-django-appconf)))
     (synopsis "Generate JavaScript catalog to static files")
     (description
       "A Django app that provides helper for generating JavaScript catalog to
@@ -1014,7 +1032,7 @@ static files.")
              (setenv "DJANGO_SETTINGS_MODULE" "tagging.tests.settings")
              (invoke "django-admin" "test" "--pythonpath=."))))))
     (inputs
-     `(("python-django" ,python-django)))
+     (list python-django))
     (home-page "https://github.com/Fantomas42/django-tagging")
     (synopsis "Generic tagging application for Django")
     (description "This package provides a generic tagging application for
@@ -1022,21 +1040,33 @@ Django projects, which allows association of a number of tags with any
 @code{Model} instance and makes retrieval of tags simple.")
     (license license:bsd-3)))
 
-(define-public python-djangorestframework
+(define-public python-django-rest-framework
   (package
-    (name "python-djangorestframework")
-    (version "3.12.4")
+    (name "python-django-rest-framework")
+    (version "3.13.1")
     (source
      (origin
-       (method url-fetch)
-       (uri (pypi-uri "djangorestframework" version))
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/encode/django-rest-framework")
+             (commit version)))
+       (file-name (git-file-name name version))
        (sha256
         (base32
-         "1wm7q3vp4226n6fhjnkjxg6pgh95p6ag238rg7l7dj6sind98izp"))))
+         "11wfb156yin6mlgcdzfmi267jsq1cld131mxgd13aqsrj06zlray"))))
     (build-system python-build-system)
     (arguments
-     '(;; No included tests
-       #:tests? #f))
+     '(#:phases
+       (modify-phases %standard-phases
+         (replace 'check
+           (lambda* (#:key tests? inputs #:allow-other-keys)
+             (if tests?
+                 (invoke "python" "runtests.py")
+                 (format #t "test suite not run~%")))))))
+    (native-inputs
+     (list python-pytest python-pytest-django tzdata-for-tests))
+    (propagated-inputs
+     (list python-django python-pytz))
     (home-page "https://www.django-rest-framework.org")
     (synopsis "Toolkit for building Web APIs with Django")
     (description
@@ -1044,6 +1074,9 @@ Django projects, which allows association of a number of tags with any
 provides features like a Web-browsable API and authentication policies.")
     (license license:bsd-2)))
 
+(define-public python-djangorestframework
+  (deprecated-package "python-djangorestframework" python-django-rest-framework))
+
 (define-public python-django-sekizai
   (package
     (name "python-django-sekizai")
@@ -1057,11 +1090,8 @@ provides features like a Web-browsable API and authentication policies.")
           "0vrkli625b5s1wldri3dyrfvqbxg7zxy2pg0rpjixw3b1ndz0ag8"))))
     (build-system python-build-system)
     (arguments '(#:tests? #f)) ; Tests not included with release.
-    (native-inputs
-     `(("python-django" ,python-django)))
     (propagated-inputs
-     `(("python-django-classy-tags" ,python-django-classy-tags)
-       ("python-six" ,python-six)))
+     (list python-django python-django-classy-tags python-six))
     (home-page "https://github.com/divio/django-sekizai")
     (synopsis "Template blocks for Django projects")
     (description "Sekizai means blocks in Japanese, and that is what this app
@@ -1089,8 +1119,8 @@ a single block.")
     (arguments
      '(;; No included tests
        #:tests? #f))
-    (native-inputs
-     `(("python-django" ,python-django)))
+    (propagated-inputs
+     (list python-django))
     (home-page
      "http://github.com/maraujop/django-crispy-forms")
     (synopsis "Tool to control Django forms without custom templates")
@@ -1102,14 +1132,13 @@ forms using your favorite CSS framework, without writing template code.")
 (define-public python-django-compressor
   (package
     (name "python-django-compressor")
-    (version "2.4")
+    (version "2.4.1")
     (source
       (origin
         (method url-fetch)
         (uri (pypi-uri "django_compressor" version))
         (sha256
-         (base32
-          "0kx7bclfa0sxlsz6ka70zr9ra00lks0hmv1kc99wbanx6xhirvfj"))))
+         (base32 "1q0m0hfg7sqmj5km924g4dgy3nx51aszzsprlp6gsin10mv0fn1k"))))
     (build-system python-build-system)
     (arguments
      '(#:phases
@@ -1126,15 +1155,10 @@ forms using your favorite CSS framework, without writing template code.")
        ;; https://github.com/django-compressor/django-compressor/issues/998
        #:tests? #f))
     (propagated-inputs
-     `(("python-django-appconf" ,python-django-appconf)
-       ("python-rcssmin" ,python-rcssmin)
-       ("python-rjsmin" ,python-rjsmin)))
+     (list python-django-appconf python-rcssmin python-rjsmin))
     (native-inputs
-     `(("python-beautifulsoup4" ,python-beautifulsoup4)
-       ("python-brotli" ,python-brotli)
-       ("python-csscompressor" ,python-csscompressor)
-       ("python-django-sekizai" ,python-django-sekizai)
-       ("python-mock" ,python-mock)))
+     (list python-beautifulsoup4 python-brotli python-csscompressor
+           python-django-sekizai python-mock))
     (home-page "https://django-compressor.readthedocs.io/en/latest/")
     (synopsis
      "Compress linked and inline JavaScript or CSS into single cached files")
@@ -1165,8 +1189,9 @@ template tag.")
                     (lambda _
                       (invoke "python" "runtests.py"))))))
     (native-inputs
-     `(("python-django" ,python-django)
-       ("python-mock" ,python-mock)))
+     (list python-mock))
+    (propagated-inputs
+     (list python-django))
     (synopsis "Django test helpers to manage file storage side effects")
     (description
      "This project provides tools to help reduce the side effects of using
@@ -1176,32 +1201,44 @@ FileFields during tests.")
 (define-public python-django-auth-ldap
   (package
     (name "python-django-auth-ldap")
-    (version "2.4.0")
+    (version "4.1.0")
     (source (origin
               (method url-fetch)
               (uri (pypi-uri "django-auth-ldap" version))
               (sha256
                (base32
-                "0xk6cxiqz5j3q79bd54x64f26alrlc8p7k9wkp2c768w2k1vzz30"))))
+                "0jd9jms9qpa92fk5n7gqcxjk3zs6ay79r73ann7cw1vqn79lkxvp"))))
     (build-system python-build-system)
     (arguments
-     '(#:phases (modify-phases %standard-phases
-                  (replace 'check
-                    (lambda* (#:key inputs #:allow-other-keys)
-                      (let ((openldap (assoc-ref inputs "openldap")))
-                        ;; The tests need 'slapd' which is installed to the
-                        ;; libexec directory of OpenLDAP.
-                        (setenv "SLAPD" (string-append openldap "/libexec/slapd"))
-                        (setenv "SCHEMA"
-                                (string-append openldap "/etc/openldap/schema"))
-                        (invoke "python" "-m" "django" "test"
-                                "--settings" "tests.settings")))))))
+     (list #:phases
+           #~(modify-phases %standard-phases
+               (replace 'build
+                 (lambda _
+                   ;; Set file modification times to the early 80's because
+                   ;; the Zip format does not support earlier timestamps.
+                   (setenv "SOURCE_DATE_EPOCH"
+                           (number->string (* 10 366 24 60 60)))
+                   (invoke "python" "-m" "build" "--wheel"
+                           "--no-isolation" ".")))
+               (replace 'check
+                 (lambda* (#:key inputs #:allow-other-keys)
+                   (setenv "SLAPD" (search-input-file inputs "/libexec/slapd"))
+                   (setenv "SCHEMA"
+                           (search-input-directory inputs "etc/openldap/schema"))
+                   (invoke "python" "-m" "django" "test"
+                           "--settings" "tests.settings")))
+               (replace 'install
+                 (lambda _
+                   (let ((whl (car (find-files "dist" "\\.whl$"))))
+                     (invoke "pip" "--no-cache-dir" "--no-input"
+                             "install" "--no-deps" "--prefix" #$output whl)))))))
     (native-inputs
-     `(("openldap" ,openldap)
-       ("python-django" ,python-django)
-       ("python-mock" ,python-mock)))
+     (list openldap-2.6 python-wheel python-setuptools-scm python-toml
+
+           ;; These can be removed after <https://bugs.gnu.org/46848>.
+           python-pypa-build python-pip))
     (propagated-inputs
-     `(("python-ldap" ,python-ldap)))
+     (list python-django python-ldap))
     (home-page "https://github.com/django-auth-ldap/django-auth-ldap")
     (synopsis "Django LDAP authentication backend")
     (description
@@ -1219,13 +1256,13 @@ FileFields during tests.")
                (base32
                 "06041a8icazzp73kg93c7k1ska12wvkq7fpcad0l0sm1qnxx5yx7"))))
     (build-system python-build-system)
-    (arguments '(#:tests? #f))          ;no tests
-    (native-inputs
-     `(("python-django" ,python-django)))
+    (arguments
+     '(#:tests? #f                      ;no tests
+       #:phases (modify-phases %standard-phases
+                  ;; Importing this module requires a Django project.
+                  (delete 'sanity-check))))
     (propagated-inputs
-     `(("python-certifi" ,python-certifi)
-       ("python-elasticsearch" ,python-elasticsearch)
-       ("python-six" ,python-six)))
+     (list python-certifi python-django python-elasticsearch python-six))
     (home-page "https://github.com/cipriantarta/django-logging")
     (synopsis "Log requests/responses in various formats")
     (description
@@ -1237,21 +1274,17 @@ to ElasticSearch.")
 (define-public python-django-netfields
   (package
     (name "python-django-netfields")
-    (version "1.2.2")
+    (version "1.3.0")
     (source (origin
               (method url-fetch)
               (uri (pypi-uri "django-netfields" version))
               (sha256
                (base32
-                "1c47azr5am0q8g45x0fbn0cay7vyrack6n7k6siliw1j2p0gzi7s"))))
+                "122d0db1f420cwzrd7hynfbnnpqkjj2ridym5mrnj0l736nin5rr"))))
     (build-system python-build-system)
     (arguments '(#:tests? #f))      ;XXX: Requires a running PostgreSQL server
-    (native-inputs
-     `(("python-django" ,python-django)))
     (propagated-inputs
-     `(("python-ipaddress" ,python-ipaddress)
-       ("python-netaddr" ,python-netaddr)
-       ("python-six" ,python-six)))
+     (list python-django python-netaddr python-psycopg2 python-six))
     (home-page "https://github.com/jimfunk/django-postgresql-netfields")
     (synopsis "PostgreSQL netfields implementation for Django")
     (description
@@ -1270,35 +1303,35 @@ to ElasticSearch.")
               (file-name (git-file-name name version))
               (sha256
                (base32
-                "0r4zhqhs8y6cnplwyvcb0zpijizw1ifnszs38n4w8138657f9026"))))
+                "0r4zhqhs8y6cnplwyvcb0zpijizw1ifnszs38n4w8138657f9026"))
+              (modules '((guix build utils)))
+              (snippet
+               ;; Patch for Django 4.0 compatibility, taken from upstream pull
+               ;; request: https://github.com/miki725/django-url-filter/pull/103
+               '(substitute* "url_filter/validators.py"
+                  ((" ungettext_lazy")
+                   " ngettext_lazy")))))
     (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
+                  (add-after 'unpack 'loosen-requirements
                     (lambda _
                       ;; Do not depend on compatibility package for old
                       ;; Python versions.
                       (substitute* "requirements.txt"
-                        (("enum-compat") ""))
-                      #t))
+                        (("enum-compat") ""))))
                   (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~%")))))))
-    (native-inputs
-     `(("python-django" ,python-django)))
     (propagated-inputs
-     `(("python-cached-property" ,python-cached-property)
-       ("python-six" ,python-six)))
+     (list python-cached-property python-django python-six))
     (synopsis "Filter data via human-friendly URLs")
     (description
      "The main goal of Django URL Filter is to provide an easy URL interface
@@ -1306,3 +1339,77 @@ for filtering data.  It allows the user to safely filter by model attributes
 and also specify the lookup type for each filter (very much like
 Django's filtering system in ORM).")
     (license license:expat)))
+
+(define-public python-django-svg-image-form-field
+  (package
+    (name "python-django-svg-image-form-field")
+    (version "1.0.1")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/artrey/django-svg-image-form-field")
+             (commit (string-append version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "131m545khn8l20j4x2bvlvz36dlbnhj9pc98i2dw72s3bw8pgws0"))))
+    (build-system python-build-system)
+    (propagated-inputs
+     (list python-defusedxml python-django python-pillow))
+    (home-page "https://github.com/artrey/django-svg-image-form-field")
+    (synopsis "Form field to validate SVG and other images")
+    (description "This form field allows users to provide SVG images for
+models that use Django's standard @code{ImageField}, in addition to the
+image files already supported by it.")
+    (license license:expat)))
+
+(define-public python-django-cleanup
+  (package
+    (name "python-django-cleanup")
+    (version "6.0.0")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/un1t/django-cleanup")
+             (commit (string-append version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "0c1nghn1bnlq0a4d3sy3s363ksqsnxksixbimdy3cc6a0vk4sjps"))))
+    (build-system python-build-system)
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'patch-tests-settings
+           (lambda* (#:key inputs #:allow-other-keys)
+             ;; django-cleanup optionally integrates with
+             ;; sorl-thumbnail, which is not available in Guix yet, so
+             ;; this patch comments it out to avoid import failures in
+             ;; test settings.
+             (substitute* "django_cleanup/testapp/settings.py"
+               (("'sorl\\.thumbnail',") "# 'sorl.thumbnail',"))))
+         (replace 'check
+           (lambda* (#:key tests? inputs outputs #:allow-other-keys)
+             (when tests?
+               (add-installed-pythonpath inputs outputs)
+               ;; Add CWD to PYTHONPATH so that the tests can find the
+               ;; testapp package in the source.
+               (setenv "PYTHONPATH" (getcwd))
+               (invoke "pytest")))))))
+    (native-inputs
+     (list ;; python-django-sorl-thumbnail  ; TODO: Add to Guix.
+           python-easy-thumbnails
+           python-pillow
+           python-pytest
+           python-pytest-cov
+           python-pytest-django
+           python-pytest-xdist))
+    (propagated-inputs
+     (list python-django))
+    (home-page "https://github.com/un1t/django-cleanup")
+    (synopsis "Automatically deletes unused media files")
+    (description "This application automatically deletes user-uploaded
+files when a model is modified or deleted.  It works for FileField,
+ImageField and their subclasses.  Files set as default values for any
+FileField are not deleted.")
+    (license license:expat)))