Questions tagged [Jinja2] (39)

2
answers

Django. How to display all fields from the model to the template instead of listing them?

A model in which many fields. About 20 pieces, various types, including FileField. How to use the For loop output in the template, not to amend the template each time you edit the model? Use The DetailView. I would like to see in the pattern something like this: {% for field in some_model.fields %} {{ field.name }}: {{ fie...
Eliseo43 asked April 19th 20 at 12:11
3
answers

How to make re-render the page with preservation of classes of objects?

The issue is complex. The site has a treeview in each tab is some detail, the modification which the user can change. Modifications are carried out by sending to the server form with the modified modification. The problem is that when you submit a form the request is made to the address of the handler, then back to the page...
bridgette60 asked April 9th 20 at 10:51
1
answer

Why not iteresuet a QuerySet?

{{topSale}}//(<a QuerySet [<Product: Kiwi>, <Product: Carrot>, <Product: Garnet>]>,) {% for i in topSale %} {{i}}//<QuerySet [<Product: Kiwi>, <Product: Carrot>, <Product: Garnet>]> In square brackets the list, which is fine iteritems. view topSale = Product.objects.order_by...
juana_Feeney89 asked April 9th 20 at 09:41
1
answer

Why doesn't the code of the template?

{% if post.number|add:'-2' > 0 %} {{ posts.number|add:'-2' }} {% endif %} post.number|add:'-2' equal to 1, but when I open the site. {{posts.number|add:'-2' }} is not displayed
Kyle99 asked April 4th 20 at 00:05
1
answer

What other ways to put active class to a template in flask?

Learn flask. Make a test site using templates. The site menu in base.html. When you navigate to a specific page the link is active is highlighted, it is given a class of active. Is found the output is:<li {% if request.path == '/' %}class="active"{% endif %}> <a href="/">Home</a> </li> Is this corre...
Ward.Fahey asked April 3rd 20 at 17:45
1
answer

How to make Django render templates, pulling them from the database?

Work templates on Ginge. Brought templates themselves via {{ some_html | safe }}, the page generates fine, but here's the problem: In this very template I want to add new markup to the page. That is, in surrendering things are still investing, a La "{{ folderol | safe }}". Really is such a perversion? Or you will have to fi...
Kasandra40 asked March 31st 20 at 21:39
1
answer

How to sample values from the list by key using jinja?

Greetings to all. There is a list of values:services: - name: es dirs: { type: "es_script", path: "/opt/distrib/efk/script", user: "elasticsearch", group: "elasticsearch", mode: '0765' } { type: "es_config", path: "/etc/elasticsearch", user: "elasticsearch", group: "elasticsearch", mode: '0765' } - { type: es_data, pa...
Lavada69 asked March 31st 20 at 20:09
1
answer

Jinja2. What's the difference extends from the include?

one inherits the other includes. In practice, the difference did not see
Beth_Schoen asked March 31st 20 at 15:53
0
answer

How to introduce strech communication table entry in a list?

Hi! There are three tables in PostgreSQL. branches, divisions, areas. How to create a query to output to this format?branch 1 отдел1 участок1.1 участок1.2 отдел2 участок2.1 участок2.2 branch 2 ..... .... ... Use SQLAlchemybranches_workshop = db.Table('branches_workshop', db.Column('branches_id', db.Integer(), db.ForeignKe...
Era asked March 29th 20 at 21:44
1
answer

How to encrypt file path in jinja2?

Let's say you have to change the path to the image:<img class="_1data" src="{{url_for('static', filename='data/avatars/1.png')}}"> Is it possible to encrypt the file path in jinja2?
marta_Schamberg asked March 27th 20 at 12:47