fastapi-rocket-boilerplate icon indicating copy to clipboard operation
fastapi-rocket-boilerplate copied to clipboard

Admin: Fix popup for reverse_delete

Open asacristani opened this issue 1 year ago • 3 comments

Now the message for delete and reverse_delete is the same (delete message). It could be good to modify for reverse_delete being more accurate.

asacristani avatar Oct 11 '23 11:10 asacristani

I had a look at this issue, the message shown during delete is hardcoded into the javascript code for sqladmin. Found here at sqladmin/statics/js/main.js. Will have to look into the feasibility of overriding this js code.

sajankp avatar Oct 16 '23 06:10 sajankp

@sajankp thanks for having a look mate, feel free to open a PR 🚀

asacristani avatar Oct 16 '23 14:10 asacristani

The delete method do not pass information other than the model name, id used specific to the instance being deleted (sql admin implementation). Hence unable to access the "deleted" parameter within the js code. The other way is to read it from the specific column using JS, but for any model that will not have the column deleted listed in the view will cause this feature to break, and this would be more of a hack than a good fix.

The ideal solution would be to have a separate action https://aminalaee.dev/sqladmin/configurations/#custom-action which does soft delete and have it's own template.

Leaving this message for future reference

sajankp avatar Oct 24 '23 10:10 sajankp