Skip to content

Allow the use of template filters in arguments #181

Description

@benbacardi

Hey, I discovered this library coming from Tim Schilling's post about the new simple_block_tag landing in Django 5.2, and it looks to match exactly how I think about "components" fitting in with the Django Template Language, so thank you!

My one request would be to add support for template filters in the arguments to {% bird %}. Currently, this kind of thing is not possible:

{% bird:prop count=None %}
<button class="btn btn-primary">
  {% if count is not None %}<span class="badge badge-light">{{ count }}</span>{% endif %}
  {{ slot }}
</button>
{% bird "button" count=users|length %}
  Click me!
{% endbird %}

The component sees users|length as a single context variable and renders it as-is (due to the behaviour for missing variables). This is quite unexpected when you're used to how template filters work in other Django template tags, and it'd be great if it was supported.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions