You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When wanting to use htpy with a django project with existing templates, it would be nice to have a helper to directly extend a django base template, something like:
importhtpyashfromhtpy.djangoimportextend_templateresult=template_extend(
'admin/base_site.html',
breadcrumbs=h.div(".breadcrumbs"),
coltype="colM",
content=div('.module.report')[...],
) # result is a string with the blocks filled in.
This can probably be implemented by just creating a template string dynamically like f"{{% extends {base_template}" %}}" and then creating a bunch of f"{{% block {name} %}}{htpy_contents}{{% endblock %}}"s dynamically and then passing that string to Template(X).render(..)`
The text was updated successfully, but these errors were encountered:
the values needs to be passed via context and not passed directly to Template to avoid security problems. how to deal with {{ block.super }} though? maybe it cannot be supported
When wanting to use htpy with a django project with existing templates, it would be nice to have a helper to directly extend a django base template, something like:
This can probably be implemented by just creating a template string dynamically like f"{{% extends {base_template}" %}}" and then creating a bunch of f"{{% block {name} %}}{htpy_contents}{{% endblock %}}"s dynamically and then passing that string to Template(X).render(..)`
The text was updated successfully, but these errors were encountered: