carltongibson / neapolitan

Quick CRUD views for Django
https://noumenal.es/neapolitan/
MIT License
413 stars 30 forks source link

Move rendering of `action_links` from templatetag to `list.html` template partial #39

Open joshuadavidthomas opened 5 months ago

joshuadavidthomas commented 5 months ago

Currently as a user of neapolitan there's no easy way to adjust how the action links are rendered in CRUDView's list view, since the links are rendered to a string within the templatetag.

I got around this by creating my own object_list templatetag that calls a new action_links function that, instead of rendering to a string, returns a dictionary with the relevant info that can then taken by the template and rendered there. This approach allows for greater flexibility for anyone using neapolitan to adjust how the actions are rendered.

Here's the relevant commit to see how this would look.

carltongibson commented 3 months ago

Yes, I find myself overriding all this very quickly.

I want to address reversing URLs, and the structure of the default templates here, so let me keep this in mind for the moment.

(Just need to decide how it's meant to look 😅)