1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 fetchpatch,
6 python,
7 django,
8 dj-database-url,
9}:
10
11buildPythonPackage rec {
12 pname = "django-polymorphic";
13 version = "3.1";
14 format = "setuptools";
15
16 src = fetchFromGitHub {
17 owner = "django-polymorphic";
18 repo = "django-polymorphic";
19 rev = "v${version}";
20 hash = "sha256-JJY+FoMPSnWuSsNIas2JedGJpdm6RfPE3E1VIjGuXIc=";
21 };
22
23 patches = [
24 # Spelling of assertQuerySetEqual changed in Django >= 4.2
25 (fetchpatch {
26 url = "https://github.com/jazzband/django-polymorphic/commit/63d291f8771847e716a37652f239e3966a3360e1.patch";
27 hash = "sha256-rvvD9zfjm8bgH1460BA5K44Oobzv1FRAYq9Rgg291B8=";
28 })
29 ];
30
31 propagatedBuildInputs = [ django ];
32
33 nativeCheckInputs = [ dj-database-url ];
34
35 # Tests fail for Django >= 5.1.0
36 doCheck = lib.versionOlder django.version "5.1.0";
37
38 checkPhase = ''
39 ${python.interpreter} runtests.py
40 '';
41
42 pythonImportsCheck = [ "polymorphic" ];
43
44 meta = with lib; {
45 homepage = "https://github.com/django-polymorphic/django-polymorphic";
46 description = "Improved Django model inheritance with automatic downcasting";
47 license = licenses.bsd3;
48 maintainers = [ ];
49 };
50}