django-extra-settings icon indicating copy to clipboard operation
django-extra-settings copied to clipboard

List view showing every setting type when grappelli is installed

Open perepicornell opened this issue 2 years ago • 3 comments

Python version 3.9.12

Django version 3.2.14

Package version Latest (installed today from pypi)

Hi! I'm finding this package very interesting, so I'm studying the possibility of dropping Constance and replace it with it, specially for the file types support.

This question might belong to grappelli's project, but given that every other app (including constance) is working correctly, I decided to start by asking here.

Setup:

  • If I disable grappelli from INSTALLED_APPS, everything works fine, like shown at the readme's screenshot.
  • If it's present, regardless of loading the extra_settings app after or before grappelli, it looks like this:

imatge

I registered it both by using grappelli's dashboard (so, the path becomes /admin/extra_settings/setting/), and registering it in a specific app (by doing register_extra_settings_admin("app_name"), and then the path is /admin/app_name/setting/). In both ways the result is the same.

When the issue is happening, you can still click on one of the settings and edit it, and the form only shows the right field and it works.

I tried to understand the way the admin registration is done to find some workaround, but I couldn't.

Any ideas?

Many thanks for your work! :heart:

Upvote & Fund

  • We're using Polar.sh so you can upvote and help fund this issue.
  • We receive the funding once the issue is completed & confirmed by you.
  • Thank you in advance for helping prioritize & fund our backlog.
Fund with Polar

perepicornell avatar Apr 19 '24 11:04 perepicornell

@perepicornell thank you for reporting this.

It seems that with grappelli installed there is a problem with the admin extra_settings.admin.SettingAdmin.Media: https://github.com/fabiocaccamo/django-extra-settings/blob/main/extra_settings/admin.py#L126C1-L130C54

Could you check if extra_settings/js/extra_settings.js is loaded correctly please? (I don't think so)

fabiocaccamo avatar Apr 22 '24 14:04 fabiocaccamo

Hi Fabio, I just tried and it's correctly loading http://localhost:5001/static/extra_settings/js/extra_settings.js 200 OK.

perepicornell avatar Apr 23 '24 13:04 perepicornell

@perepicornell so, if the js is loaded correctly (then executed) it means that the js is not able to hide the unused columns, probably because grappelli overrides the changelist template changing DOM structure or class names.

I don't consider this problem a bug of this library, but if you can debug a bit further to understand exactly what goes wrong, I would be glad to offer grappelli compatibility.

fabiocaccamo avatar May 10 '24 11:05 fabiocaccamo

Thanks a lot for taking a look, Fabio. I already solved that particular need in the project I was making changes, but if the need appears again with some other project I'll consider this possibility. Also, in new projects we won't be using Grappelli, so we'll be able to include this library anyway :) Closing for now!

perepicornell avatar May 13 '24 11:05 perepicornell

@perepicornell good, in case just let me know!

fabiocaccamo avatar May 13 '24 19:05 fabiocaccamo