otto-torino / django-baton

A cool, modern and responsive django admin application based on bootstrap 5 that brings AI to the Django admin - https://baton.sqrt64.it/
MIT License
876 stars 95 forks source link

Preserve current open tab after Save and continue editing #290

Open tyctor opened 6 months ago

tyctor commented 6 months ago

Hi

i find https://github.com/otto-torino/django-baton/issues/157#issuecomment-841306752 but in my site current tab is not preserved after Save and continue editing

i have installed Baton: rev f96ec297c0a8298b75a1b6964169099ce9a54c0c

i read through https://django-baton.readthedocs.io/en/latest/form_tabs.html but i did find anything about preserving tabs

can you please advice me, what to check?

tyctor commented 6 months ago

i found this:

you can open a tab on page load just by adding an hash to the url, i.e. #inline-feature, #fs-content, #group-fs-tech–inline-feature

yes, it is working, when i manually construct such url but POST (Save and continue editing) url is not changing hash element against context (tab) from which was clicked it is how it should working? (change hash element in form url when tab is clicked)

abidibo commented 6 months ago

@tyctor which baton version? There has been a regression some time ago' fixed in the last releases

tyctor commented 6 months ago

@abidibo you are right, after update local repository it is working now

tyctor commented 6 months ago

its working with one exception:

when i go to change_form page from filterred change_list (i.e i have filter in url, ?_changelist_filters=q%3Dplaying#inline-punctum_radio-punctumradiogenretoplay-content_type-object_id), it is not preserving tab.

abidibo commented 6 months ago

Hi @tyctor yes, you're right. That happens because when there is something in the query string, the hash gets lost, and when reloading Baton cannot retrieve the right tab. I'm not sure there is an easy way to fix this (using local storage is an option but I don't like it too much).