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

birger/1446 template loader list #1449

Merged
merged 2 commits into from
Nov 27, 2024
Merged

Conversation

b1rger
Copy link
Contributor

@b1rger b1rger commented Nov 25, 2024

  • feat(generic): add a templatetag wrapper for template_names_via_mro
  • fix(generic)!: replace object_table.html by template_list lookup

The template_list templatetag returns a list of templatenames, based on
the MRO of the model passed and a suffix. So instead of hardcoding the
`object_table.html` template, we now use this list to look for matching
templates, which makes it easier to overload the template.
Given that all the models inherit at some point from `genericmodel`, the
`object_table.html` template is now being replaced by a
`genericmodel_card_table.html` template.
Using this template_list approach, it is probably possible to drop some
of the templates alltogether and make the template inheritance chain way
less complex.

Closes: #1446
@b1rger b1rger marked this pull request as ready for review November 25, 2024 14:43
@b1rger b1rger requested a review from gythaogg November 25, 2024 14:48
Copy link
Contributor

@gythaogg gythaogg left a comment

Choose a reason for hiding this comment

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

Neat!

@gythaogg gythaogg linked an issue Nov 26, 2024 that may be closed by this pull request
@b1rger b1rger merged commit 055ec94 into main Nov 27, 2024
14 checks passed
@b1rger b1rger deleted the birger/1446-template-loader-list branch November 27, 2024 07:35
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.

refactoring: abstract entity template
2 participants