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

Add option for remember fieldsets.collapse state (visible/hidden). #160

Closed
fabiocaccamo opened this issue May 6, 2022 · 9 comments
Closed
Assignees
Labels
enhancement New feature or request

Comments

@fabiocaccamo
Copy link
Owner

fabiocaccamo commented May 6, 2022

Fund with Polar
@luciano-im
Copy link

Hello, I can help with a PR for this issue, is that ok or is it already assigned?

@fabiocaccamo
Copy link
Owner Author

@luciano-im this issue is not assigned, any contribution is appreciated!

@luciano-im
Copy link

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?

@fabiocaccamo
Copy link
Owner Author

fabiocaccamo commented Jul 20, 2023

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.

@luciano-im
Copy link

I understand clearly. Let me see if I can find a javascript solution so that the default template doesn't need to be overridden.

@fabiocaccamo
Copy link
Owner Author

@luciano-im any update?

@luciano-im
Copy link

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.

@fabiocaccamo
Copy link
Owner Author

@luciano-im no problem, thank you for the update!

@fabiocaccamo
Copy link
Owner Author

@luciano-im I close this as it is stale, I will be glad to re-open it if needed.

@fabiocaccamo fabiocaccamo closed this as not planned Won't fix, can't repro, duplicate, stale Feb 19, 2024
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
Archived in project
Development

No branches or pull requests

2 participants