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

Pass context to template tag override #193

Open
tbrlpld opened this issue Apr 10, 2022 · 0 comments
Open

Pass context to template tag override #193

tbrlpld opened this issue Apr 10, 2022 · 0 comments
Labels
django Related to Django templates capabilities enhancement New feature or request help wanted Extra attention is needed
Milestone

Comments

@tbrlpld
Copy link
Collaborator

tbrlpld commented Apr 10, 2022

Is your proposal related to a problem?

When overriding a template tag you have the option to render another template in its place.

Currently, only the existing template context (from the yaml file) of that template will be taken into account.
It would be nice to have the option to pass context overrides to the template.

Describe the solution you'd like

E.g. in a template override like this:

tags:
  include_block:
    tl with size="2xl" heading_level=sub_heading_level:
      template_name: "atoms/teaser-link/teaser-link.html"

I would love to be able to do something like this:

tags:
  include_block:
    tl with size="2xl" heading_level=sub_heading_level:
      template_name: "atoms/teaser-link/teaser-link.html"
      context_override: 
        size: "2xl"
        heading: "Overrding the heading form the template context yaml"

Describe alternatives you've considered

An alternative is to create specific variants of the template I really want to use. That has the tendency to clutter the template directly.

@thibaudcolas thibaudcolas added enhancement New feature or request help wanted Extra attention is needed django Related to Django templates capabilities labels Apr 11, 2022
@thibaudcolas thibaudcolas added this to the v1.1.0 milestone Jun 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
django Related to Django templates capabilities enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants