fabiocaccamo / django-extra-settings

:gear: config and manage typed extra settings using just the django admin.
MIT License
534 stars 32 forks source link

List view showing every setting type when grappelli is installed #146

Closed perepicornell closed 5 months ago

perepicornell commented 6 months ago

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:

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

Fund with Polar

fabiocaccamo commented 6 months ago

@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)

perepicornell commented 6 months ago

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

fabiocaccamo commented 6 months ago

@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.

perepicornell commented 5 months ago

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!

fabiocaccamo commented 5 months ago

@perepicornell good, in case just let me know!