Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extend django admin templates #296

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

balazs-endresz
Copy link
Contributor

All Submissions:

  • Are tests passing? (From the root-level of the repository please run pip install tox && tox)
  • I have added or updated a test to cover the changes proposed in this Pull Request
  • I have updated the documentation to cover the changes proposed in this Pull Request (not sure if this is needed)

This one might be more controversial but if you decide to fully decouple from the django admin later on, then this won't really make that any more difficult either. And at least we'd get consistent styling, dark mode, and likely better support for custom admin themes too.

The template changes were fairly simple, and most of the css is only to fix a lot of minor alignment issues.

Click to show files needed from the django admin, when the django admin is not used
https://raw.githubusercontent.com/django/django/refs/heads/main/django/contrib/admin/templates/admin/base.html
https://raw.githubusercontent.com/django/django/refs/heads/main/django/contrib/admin/templates/admin/color_theme_toggle.html
https://raw.githubusercontent.com/django/django/refs/heads/main/django/contrib/admin/static/admin/js/theme.js
https://raw.githubusercontent.com/django/django/refs/heads/main/django/contrib/admin/static/admin/js/nav_sidebar.js
https://raw.githubusercontent.com/django/django/refs/heads/main/django/contrib/admin/static/admin/img/search.svg
https://raw.githubusercontent.com/django/django/refs/heads/main/django/contrib/admin/static/admin/css/base.css
https://raw.githubusercontent.com/django/django/refs/heads/main/django/contrib/admin/static/admin/css/dark_mode.css 
https://raw.githubusercontent.com/django/django/refs/heads/main/django/contrib/admin/static/admin/css/nav_sidebar.css
https://raw.githubusercontent.com/django/django/refs/heads/main/django/contrib/admin/static/admin/css/rtl.css
https://raw.githubusercontent.com/django/django/refs/heads/main/django/contrib/admin/static/admin/css/responsive.css
https://raw.githubusercontent.com/django/django/refs/heads/main/django/contrib/admin/static/admin/css/changelists.css
https://raw.githubusercontent.com/django/django/refs/heads/main/django/contrib/admin/static/admin/css/responsive_rtl.css

(Btw, you might have missed it but the last two squashed commit messages are not very helpful when looking at the history at a glance.)

@mbi
Copy link
Owner

mbi commented Oct 10, 2024

So, not sure about this one. Why / under which circumstances would it make sense to decouple from the django admin and thus require a fork of the admin templates / statics? 🤔

@balazs-endresz
Copy link
Contributor Author

I only mentioned that because I saw there was a ticket about it: #228

And I was just pointing out here that even after this MR it won't really be any more difficult to fork of the admin templates / statics later.

And if someone wants to remove the django admin from installed apps then placing these files in their own project's static and template directories would still work too.

@mbi
Copy link
Owner

mbi commented Oct 10, 2024

Gotcha thanks! Most of my projects make use of the Django admin, so decoupling and maintaining a fork of Django's admin templates/css/js is not very high on my own personal priorities list for Rosetta.

That said, I imagine that the users interested in #228 will take notice of your PR and maybe include it in their forks.

@balazs-endresz
Copy link
Contributor Author

balazs-endresz commented Nov 5, 2024

I've just noticed a couple of issues, will sort this out soon:

  • pagination is right aligned for some reason but adding display:block fixes it
  • remove block for django messages and rely on the one in the django base template + amend tests

@balazs-endresz
Copy link
Contributor Author

That's all sorted now.

(The next one will be some basic server side validation if this is merged)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants