carltongibson / neapolitan

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

Is there a way to add a column with custom HTML to a table? #54

Open GregShiner opened 3 months ago

GregShiner commented 3 months ago

I've been digging for a while and I can't find anything that would do this. I would love to extend the functionality a bit by adding a few things like additional buttons on each row. Or by making certain elements clickable to have different actions. If this doesn't exist already, I think this would make a pretty great feature. There's already great ways of overriding the different role actions, but I am still limited to only those roles. Maybe a way to add additional roles? It would be a big ask, but maybe reworking neapolitan.views.Role from an enum.Enum to an interface or abstract class would allow users to create additional roles. Maybe the row could be a partial template that can be overridden with the manage.py mktemplate command. I think that would be my preferred solution.

E: I suppose I could override the whole Role class and set the CRUDView.role property to it. Also having Role be an abstract class would make the process quite a bit easier so I dont have to copy all of the match statements. Still though, it would be really cool if we could override the row partial template as well.