From e31731f8e6ca1e787064a2ba58eb72ec5b0e1079 Mon Sep 17 00:00:00 2001 From: Tom Hubrecht Date: Sat, 21 Sep 2024 23:01:21 +0200 Subject: [PATCH] feat(apps): Install django-unfold --- default.nix | 1 + pkgs/django-unfold/default.nix | 40 ++++++++++++++++++++++++++++++++++ src/app/settings.py | 1 + src/app/urls.py | 2 +- 4 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 pkgs/django-unfold/default.nix diff --git a/default.nix b/default.nix index 60a6190..33d30c0 100644 --- a/default.nix +++ b/default.nix @@ -54,6 +54,7 @@ in ps.django-sass-processor ps.django-sass-processor-dart-sass ps.django-stubs + ps.django-unfold ps.ipython ps.loadcredential ps.pykanidm diff --git a/pkgs/django-unfold/default.nix b/pkgs/django-unfold/default.nix new file mode 100644 index 0000000..a6d1889 --- /dev/null +++ b/pkgs/django-unfold/default.nix @@ -0,0 +1,40 @@ +{ + lib, + buildPythonPackage, + fetchFromGitHub, + poetry-core, + django, +}: + +buildPythonPackage rec { + pname = "django-unfold"; + version = "0.39.0"; + pyproject = true; + + src = fetchFromGitHub { + owner = "unfoldadmin"; + repo = "django-unfold"; + rev = version; + hash = "sha256-CmmlTx2eLcANc6ANy25ii1KVebkmUEJmDCe+/RwakAg="; + }; + + build-system = [ + poetry-core + ]; + + dependencies = [ + django + ]; + + pythonImportsCheck = [ + "unfold" + ]; + + meta = { + description = "Modern Django admin theme for seamless interface development"; + homepage = "https://github.com/unfoldadmin/django-unfold"; + changelog = "https://github.com/unfoldadmin/django-unfold/blob/${src.rev}/CHANGELOG.md"; + license = lib.licenses.mit; + maintainers = with lib.maintainers; [ ]; + }; +} diff --git a/src/app/settings.py b/src/app/settings.py index 59c3418..dd6ea60 100644 --- a/src/app/settings.py +++ b/src/app/settings.py @@ -24,6 +24,7 @@ ALLOWED_HOSTS = credentials.get_json("ALLOWED_HOSTS", []) # List the installed applications INSTALLED_APPS = [ + "unfold", "django.contrib.admin", "django.contrib.auth", "django.contrib.contenttypes", diff --git a/src/app/urls.py b/src/app/urls.py index 19fb416..7a3942a 100644 --- a/src/app/urls.py +++ b/src/app/urls.py @@ -25,11 +25,11 @@ urlpatterns = [ path("login", TemplateView.as_view(template_name="login.html"), name="login"), path("", include("dgsi.urls")), path("accounts/", include("allauth.urls")), + path("admin/", admin.site.urls), ] if settings.DEBUG: urlpatterns += [ - path("admin/", admin.site.urls), path("__reload__/", include("django_browser_reload.urls")), path("__debug__/", include("debug_toolbar.urls")), ] + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)