Skip to content

Conversation

@joshuadavidthomas
Copy link
Member

@joshuadavidthomas joshuadavidthomas commented Jul 30, 2024

Adds a detail_field_renderers attribute to CRUDView that is a dictionary of fields to callables that return strings. Allows for customizing the rendering of certain fields in the detail view without having to resort to a custom object_detail.html template just for one field.
Review on CodeApprove

@joshuadavidthomas
Copy link
Member Author

@jefftriplett Not sure on this one, but I find myself wanting to tweak how a certain field is rendered in the template frequently and find it annoying to have to create a whole custom template and/or templatetag just for that one field.

Going this route initially as a instead of my initial thought of "List view fields can have widgets through the django_tables2.columns.Column and form view fields can have widgets through form widgets, what if detail view fields also had widgets??"

@joshuadavidthomas joshuadavidthomas marked this pull request as draft July 30, 2024 15:42
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does overriding the neapolitan.py template make it work better with default templates, or does it create confusion when people start looking for what is going on, or why a new project without this template tag doesn't work?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. I kept it this way to ease the transition, but don't necessarily care about keeping the templatetag module named the same. I'd rather go for clarity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants