Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add ability to customize how detail fields are rendered #88

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from

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

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.

2 participants