-
-
Notifications
You must be signed in to change notification settings - Fork 22
Jinja2 template support #197
-
I understand that the current way reactpy-django integrates with Django is based on Django's native templates. Is there any prospect of integration with Django's alternative Jinja2-templates?
Beta Was this translation helpful? Give feedback.
All reactions
Replies: 4 comments 1 reply
-
To be honest I've never used Jinja2 within Django. However, I'm open to the idea of it.
It would be really easy to replicate our current template tag with jinja2-simple-tags. Or alternatively, if Django has some built-in system for Jinja2, we could utilize that.
Would you be interested in creating a PR for this?
Beta Was this translation helpful? Give feedback.
All reactions
-
Yes I would. I do have some experience of creating custom Jinja2 tags, but my knowledge on the JS side is pretty scant (I use vanilla ES6 JS. but nothing like a transpiler, tree-shaking or framework such as React. For me, I'd need to use the experience to learn how the rest of the world does JS ;-)).
I'll get back in touch when I have something.
Beta Was this translation helpful? Give feedback.
All reactions
-
A PR adding Jinja2 support would not involve any JS. All of our JavaScript code already exists, and should not be modified for this.
The two following things would need to be accomplished/confirmed:
- Make sure our existing HTML template can render with Jinja2.
- Either create a
./templates/component-jinja2.htmltemplate or figure out some way to make the existing template work for both Jinja2 and Django interchangeably. - Here's a workaround for the
statictag that could be useful?
- Either create a
- Make sure the existing Django Template Tag works with Jinja2.
- I've always assumed that Django template tags somehow automagically work with Jinja2.
Beta Was this translation helpful? Give feedback.
All reactions
-
A PR adding Jinja2 support would not involve any JS. All of our JavaScript code already exists, and should not be modified for this.
Ack. I was more thinking of what I'd need to learn to test the new template!
The two following things would need to be accomplished/confirmed:
Thanks for the pointers. Luckily I've some experience creating Jinja2 tags (I contributed the existing "debug" tag) and am not expecting problems with that bit.
Beta Was this translation helpful? Give feedback.
All reactions
-
See #198
Beta Was this translation helpful? Give feedback.