saxix/django-adminactions

adminactions.min.css cannot be found

SeverinBuchser opened this issue · 0 comments

Hello

For the merge action, the adminactions.min.css cannot be found (I get a 404).

OS: macOS Sonoma Version 14.2.1
Pipfile:

[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"

[packages]
django-adminactions = "==2.3.0"
django = "==5.0.1"

[dev-packages]

[requires]
python_version = "3.11"

settings.py:

...
INSTALLED_APPS = [
    "django.contrib.admin",
    "django.contrib.auth",
    "django.contrib.contenttypes",
    "django.contrib.sessions",
    "django.contrib.messages",
    "django.contrib.staticfiles",
    "adminactions"
]
...

urls.py:

from django.contrib import admin
from django.urls import include, path
from django.contrib.admin import site
from adminactions import actions

actions.add_to_site(site)

urlpatterns = [
    path("admin/", admin.site.urls),
    path("adminactions/", include("adminactions.urls")),
]

Reporduction Steps

  1. Create a new django project (django-admin startproject <project-name>) with the specified packages from the Pipfile.
  2. Add adminactions to the installed apps (see above).
  3. Add adminactions to the urls and actions.add_to_site(site) (see above).
  4. Run migrations, create a superuser and run the project.
  5. Create another user in django admin
  6. Go to /admin/auth/users, select both users and exectute the "Merge selected users" action.
  7. Now you should see GET http://127.0.0.1:8000/static/adminactions/css/adminactions.min.css net::ERR_ABORTED 404 (Not Found) in the console.

Propbable Cause

I assume this is because in the source I found this line:

css = {"all": ["adminactions/css/adminactions.min.css"]}

But as far as I see, no adminactions.min.css actually exists in the static files. I think this line should be

 css = {"all": ["adminactions/css/adminactions.css"]} 

This file actually exists.

Workaround

For now i solved the issue by creating a static file static/adminactions/css/adminactions.min.css and copied the contents of static/adminactions/css/adminactions.css into the new file.