Closed blinklet closed 1 month ago
Considering if this is really needed. There is a way to do this using the standard "include" statement, as described at the end of the following issues: https://github.com/mikeckennedy/jinja_partials/issues/1
Regardless of whether I use "include" or "render_partial", I still need to identify redundant template code and organize it into partials, then try one of the solutions.
I do not currently have a situation where I have redundant template code. So, I will work on #6 and #26 which will require I add some partial templates that will be used by HTMX in the page and when actions occur in the page. (I could also revisit PR #40 and re-implement it so the table is regenerated in a partial instead of re-rendering the whole page (but then I would have so solve the URL-publishing issue to support deep-linking).
I recently removed HTMX from my program. I will use it again when I find a more appropriate situation, like creating genuine interactivity on a page. When I do, I will use the standard "include" statement to add the partial template. I will avoid using a new library that is not absolutely needed.
Closing.
Install the Jinja-Partials package and use it so I do not have duplicate template code in a template and in a partial. This will let me re-use partials in the page templates and make cleaner code.
See: https://github.com/mikeckennedy/jinja_partials and the accompanying blog post.
Also consider using Jinja macros. See this discussion for information about that.