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

Utilize Django Template Loaders #49

Open
geoffrey-eisenbarth opened this issue Jan 24, 2024 · 1 comment
Open

Utilize Django Template Loaders #49

geoffrey-eisenbarth opened this issue Jan 24, 2024 · 1 comment

Comments

@geoffrey-eisenbarth
Copy link

I'm not sure if you're aware of a similar project, django-template-partials, which allows users to render partial templates by simply appending the partial name to the template name, e.g. template_name = 'my_template.html#my-partial-name' within a TemplateResponse class-based view. I don't know the specifics of their approach (yet?), but it seems to hook into Django's Template Loaders, and if a given template name contains a #, it splits it and renders the request partial (or block, in your case).

That library does not seem to support template inheritance the way yours does (e.g., with django-render-block I can render a block defined in a parent template, but with django-template-partials it's not possible to render a partial defined in a parent template).

I'd love to be able to use a similar shorthand with your library instead of having to import and call render_block_to_string in each of the response generating methods of a given ClassBaseView.

@clokep
Copy link
Owner

clokep commented Jan 26, 2024

django-template-partials, which allows users to render partial templates by simply appending the partial name to the template name

I am aware of this and found it intriguing, but haven't had time to look into how they are doing it! It seems like a useful feature to support.

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

No branches or pull requests

2 participants