0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Djangoで変数を渡すときメモ

Posted at

テンプレートに値を渡す方法

下記のように辞書形式で渡す。

``` return TemplateResponse(request, '*****.html', {"変数名": 変数}) ```

引数をhtml内で使用する方法

下記のように記載すれば変数と同様に扱える。

```

{{ 変数名 }}

```

モデル等複数要素で構成されていれば、下記のように記載すれば同様に変数として扱える。

```

{{ 変数名.要素名 }}

```
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?