1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 flit-core,
6 wagtail,
7 dj-database-url,
8 python,
9}:
10
11buildPythonPackage rec {
12 pname = "wagtail-modeladmin";
13 version = "2.2.0";
14 pyproject = true;
15
16 src = fetchFromGitHub {
17 owner = "wagtail-nest";
18 repo = "wagtail-modeladmin";
19 tag = "v${version}";
20 hash = "sha256-P75jrH4fMODZHht+RAOd0/MutxsWtmui5Kxk8F/Ew0Q=";
21 };
22
23 # Fail with `AssertionError`
24 # AssertionError: <Warning: level=30,... > not found in [<Warning: ...>]
25 postPatch = ''
26 substituteInPlace wagtail_modeladmin/test/tests/test_simple_modeladmin.py \
27 --replace-fail \
28 "def test_model_with_single_tabbed_panel_only(" \
29 "def no_test_model_with_single_tabbed_panel_only(" \
30 --replace-fail \
31 "def test_model_with_two_tabbed_panels_only(" \
32 "def no_test_model_with_two_tabbed_panels_only("
33 '';
34
35 build-system = [ flit-core ];
36
37 dependencies = [
38 wagtail
39 ];
40
41 nativeCheckInputs = [ dj-database-url ];
42
43 pythonImportsCheck = [ "wagtail_modeladmin" ];
44
45 checkPhase = ''
46 runHook preCheck
47
48 ${python.interpreter} testmanage.py test
49
50 runHook postCheck
51 '';
52
53 meta = {
54 description = "Add any model in your project to the Wagtail admin. Formerly wagtail.contrib.modeladmin";
55 homepage = "https://github.com/wagtail-nest/wagtail-modeladmin";
56 changelog = "https://github.com/wagtail/wagtail-modeladmin/blob/${src.tag}/CHANGELOG.md";
57 license = lib.licenses.bsd3;
58 maintainers = with lib.maintainers; [ sephi ];
59 };
60}