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

Customisable admin index #79

Closed
morlandi opened this issue Apr 11, 2020 · 7 comments
Closed

Customisable admin index #79

morlandi opened this issue Apr 11, 2020 · 7 comments
Assignees
Labels
enhancement New feature or request

Comments

@morlandi
Copy link

This is more a suggestion than an issue.

I'm quite satisfied with the native Django admin, and always try to make as few customisations as possible, to prevent headaches later on when upgrading Django.

The only two aspects that bother me are:

  1. the ugly "new window" for related models, which django-admin-interface already solves with a much more effective dialog
  2. the admin index, which groups tables by app; I consider this unacceptable in many situations

Very often, the splitting of the project in apps is dictated by programmer's needs for code maintenance, which the end user doesn't understand (and doesn't care to understand).

I already have some shareable code to solve this problem.

Basically it requires:

  • overriding "admin/index.html"
  • a context processor to retrieve a customised list of apps and/or arbitrary links from project's settings
  • unfortunately, also overriding "admin/change_list.html" and "admin/change_form.html"; this is required for fixing the breadcrumbs

As a side benefit, the customised index decorates each link with specific classes (based on app_label and model_name), so the rendering can be further customised via CSS (for example providing a specific icon to each model).

Just let me know if you're interested in discussing this topic, and in case I'll provide much more details.

@morlandi morlandi added the enhancement New feature or request label Apr 11, 2020
@fabiocaccamo
Copy link
Owner

@morlandi thank you for this suggestion, I will take it into consideration.

The admin index is very very important and I already have several ideas to improve it, however I would like (as always) that all coming features prevent later issues (when upgrading Django).

Here a list of features for the admin index that I have in my notes:

  • possibility to filter apps/models using a searchbox (useful when searching for a model and there are many apps and models)

  • possibility to expand/collapse admin apps turning each app into an accordion (could be useful in case of many apps and models, to keep collapsed some apps and have more space)

  • possibility to add custom icon to each app/model, maybe overriding AppConfig.

  • possibility to use an horizontal-menu, check PR Basic horizontal menu implementation #78 and https://github.com/cdrx/django-admin-menu

  • create some widgets for the dashboard that can be easily enabled (this could be out of scope), eg. Google Analitycs, check: https://github.com/otto-torino/django-baton

@morlandi
Copy link
Author

morlandi commented Apr 12, 2020

django-baton is certainly a very interesting project, but too much for my needs. As you said, preventing later issues is crucial, and more generally I tend to limit the role of the admin as much as possible.
For more advanced functionalities, I typically focus my efforts on the frontend.
That's what I appreciate in django-admin-interface.

Back to the admin index issue, I was thinking about a much lite approach, mainly focused to organise the list of tables in arbitrary groups.
I might prepare a PR with some working code to discuss this in more detail, should you be interested in evaluating it

@merwok
Copy link
Contributor

merwok commented Apr 13, 2020

Changing the admin index is not simple. I think that it’s not something that fits in the mission of django-admin-interface. I’ve had these projects bookmarked to see if I find something I like:

@fabiocaccamo
Copy link
Owner

@merwok I don't know the packages you mentioned, but looking at the documentation it seems that django-admin-index does exactly what @morlandi needs.

@morlandi I understand your needs, but I think that customizing the admin apps is out of scope for this package, could you try django-admin-index and give some feedback about it?

@fabiocaccamo
Copy link
Owner

I could open some issues for new features and check how many users will vote for them. What do you think about it?

@morlandi
Copy link
Author

I know django-admin-index, an some time ago I adapted it for another project called django-admin-bootstrap. There is a pending PR here, to get an idea:

douglasmiranda/django-admin-bootstrap#128

My point is: I try to limit the number of dependencies of my projects, expecially for the admin.
For this reason, in my most recent Django-based projects I decided:

  1. to use django-admin-interface alone (mainly for the related-models popup)
  2. plus, a customized admin index, which I obtain directly in the project overriding admin/index.html

I do understand this might be out of scope for your package: keep it "lean" ;)

@morlandi
Copy link
Author

morlandi commented Apr 22, 2020

Hello @fabiocaccamo , I'm closing the issue ... since it's not an issue ;)
Thanks to both you and @merwok for sharing ideas.
Ciaooooo

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

No branches or pull requests

3 participants