django-admin-interface
django-admin-interface copied to clipboard
Add option for remember fieldsets.collapse state (visible/hidden).
Hello, I can help with a PR for this issue, is that ok or is it already assigned?
@luciano-im this issue is not assigned, any contribution is appreciated!
Hi Fabio, to identify each fieldset with a name to handle its state, one option is to add a data attribute to each fieldset with the name suggested in issue #173: {app_name}-{model_name}-{fieldset_name}. To achieve this, I need to include a copy of templates/admin/includes/fieldset.html to override it. Is this a good idea? I'm thinking if this could be a problem if Django changes this file in future releases?
If it's possible to override fieldset.html file, then in static/admin/js/collapse.js I could get and set the state of each rendered fieldset.
What do you think?
Hi @luciano-im, I understand the problem, an alternative could be to add the data attribute dynamically using js without overriding the default admin template. What do you think about this solution and its pro and cons?
Actually there are already some admin templates that gets overridden and frankly I'm a bit worried about potential problems in future releases, but once #301 will be done, this will be no more a big problem.
I understand clearly. Let me see if I can find a javascript solution so that the default template doesn't need to be overridden.
@luciano-im any update?
Hi @fabiocaccamo, I'm sorry but I've been busy and I couldn't finish the pull request. Next week I will be working on this again.
@luciano-im no problem, thank you for the update!
@luciano-im I close this as it is stale, I will be glad to re-open it if needed.