Questions tagged [jinja2]
Jinja2 is a fast template engine for Python. It has full Unicode support, auto-escaping, inheritance, macros, and many other features.
jinja2
9,691
questions
0
votes
0
answers
49
views
DBT - Forcing dependencies dynamically when referencing a large number of tables
I have a set of 35 models corresponding to objects of different types in my staging layer which I union in my intermediate layer. For the sake of this post I have replaced the data source that I am ...
0
votes
1
answer
41
views
How do i automate a gitlab runner setup using ansible?
Problem:
I'm working on an Ansible playbook to manage GitLab Runner registration and configuration. The playbook should:
Register a GitLab Runner and extract its token and ID.
Template a config file ...
1
vote
1
answer
61
views
Create a Sql Statement IN DBT macro and use the query in the dbt model
my_macro.sql
{macro my_macro(value)}
{% set query %}
select A from value
{{ return(query) }}
{% endset %}
{% endmacro %}
model.sql
select * from B
where A in ({{ my_macro(value) }}
when i ...
0
votes
1
answer
30
views
500:Internal server error when opening JupyterLab (4.0.11) via Anaconda (2.6.1)
I have been using JupyterLab w/ Anaconda for a while now and have not run into this issue before, but now when I open JupyterLab (4.0.11) from Anaconda, it throws an error "500 : Internal Server ...
0
votes
1
answer
33
views
Issues with DBT Compilation and Jinja
I'm running into issues with my DBT set up. Aafter setting up some linters and formatting checks, it won't run, and the error is quite vague:
Unable to do partial parsing because of a version ...
0
votes
0
answers
23
views
Socket keeps connecting and disconnecting in Flask socket.io
I am using Flask-socket.io. It works on local perfectly without any warning and error, but it keeps connecting and disconnecting in server. so first time it is not getting notification cause ...
0
votes
0
answers
22
views
static url settings in jinja2
I'm using jinja2 template in Djagon and I want to assign a static url for all my project so that I won't use long relative path in my css and js file. Below is how I set jinja2 template in Django and ...
0
votes
0
answers
22
views
Is there a way to get a user instance in template with async view?
I need to get user instance in my templates using async view
{{ request.user }} or {{ request.auser }}/
Of course i can user something like this:
async def view(request):
user = await request....
0
votes
0
answers
31
views
ValueError: dictionary update sequence element #0 has length 1; 2 is required While trying to get command line args in jinja2
I am trying to run this code :
import sys
from jinja2 import Template
vars = sys.argv
print(vars)
myTech = {
"mad 1": 'backend',
"mad 2": 'frontend'
}
temp = Template(&...
1
vote
1
answer
40
views
How to get a formatted line from a dictionary var?
I'm pretty new to Ansible and I'm not sure how to get it right.
To start with, I have implemented this dictionary var for an exemple. There is 2 values but it could be a greater number:
tf_ETCD:
1:
...
-1
votes
0
answers
26
views
Use custom Javascript function on returned FastAPI data
I'm using FastAPI to return some SQLite data to a Jinja2 template. I want to use a custom javascript function (which is contained in the section of layout.html) to display how much time has elapsed ...
-1
votes
0
answers
17
views
MoEngage // On sending an email in MoEngage, need to hide some HTML block if user has clicked on a identified link on previows campaign
I've sent an email in MoEngage with 2 questions, like this:
question 1...?
a) answer has link 1a: link_a?utm_term=2024-06-28&user_id=&receitas=doces;
b) answer has link 1b: link_b?utm_term=...
2
votes
1
answer
38
views
import python libraries in jinja2 templates
I have this template:
% template.tmpl file:
% set result = fractions.Fraction(a*d + b*c, b*d) %}
The solution of ${{a}}/{{b}} + {{c}}/{{d}}$ is ${{a * d + b*c}}/{{b*d}} = {{result.numerator}}/{{result....
-1
votes
0
answers
41
views
Why is HTML not reading my python variable properly?
I currently declare a img_path variable as such:
return render_template('index.html', img_path = r"redacted.jpg")
It works fine and dandy here:
<div class="content">
...
-1
votes
0
answers
23
views
Dates, in sequence, in For Loop must not be repeated in Jinja Print Format, instead such dates which are equal/more than 3 in sequence must be clubbed
We want the rows to be clubbed i.e. Start Absent Date to End Absent Date in Single Column Field instead of each Absent Day coming on separate row, making the table very long and useless in those case ...