torchbox / torchbox/django-pattern-library
Support overriding Jinja tags / functions / filters
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 423
- Forks
- 53
- PR merge metrics
- No merged PRs in 30d
Description
Is your proposal related to a problem?
Part of Jinja2 support plan #180. Version 1.5.0 ships with experimental Jinja support, missing the ability to override tags / functions / filters in particular.
Describe the solution you'd like
A setup similar to how Django Templates tags overrides work, with support for declaring overrides via YAML, or default values globally in Python. In Jinja it would make sense to also do this for functions, not just tags. And possibly filters while we’re at it (see also #114).
Describe alternatives you've considered
N/A
Additional context
I suspect this will require messing with the environment where we inject the custom context: https://github.com/torchbox/django-pattern-library/blob/main/pattern_library/loader_tags.py#L199. However I don’t have a good enough understanding of Jinja to know for sure.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in pattern_library/loader_tags.py around line 199 and trace how the Jinja environment receives custom context. Compare this with the existing Django template tag override behavior, then determine how YAML or global Python declarations should cover Jinja tags, functions, and filters; done means each requested override type can be declared and applied.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- django, python
- Domain
- backend, web-dev
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100