分类目录归档:flask

jinjia 基础语法


for in

{% for i in list %}
{% endfor %}
{% for k,v in dict.items() %}
{% endfor %}

if else

{% if i=1 %}
    {{ i }}
{% elif i!=1 %}
    {{ i }}
{% else %}
    {{ i }}
{% endif %}

with

{% with data %} 
{% endwith %}

url_for

<form class="form-inline" action="{{ url_for('web.search') }}" method="get

Read more

jinjia 模板继承


block base模板

{% block title %}
    <title>鱼书</title>
{% endblock %}

extends 加载 base模板

{% extends "base.html" %}
{% block title %}
    <link rel="stylesheet" href="{{ url_for('static', filename='3rd/ui/remodal.css')}}">
    <link rel="stylesheet" href="{{ url_for('static', filena

Read more