본문 바로가기

Python/Django

[Django] Django - filter

이번에는 filter 에 대해서 알아보겠습니다.

 

 

이전화면에서 몇가지 필터를 추가해보겠습니다.

 

 

<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>variable</title>
</head>
<body>
    <h1>VARIABLE.HTML</h1>
    <h2>{{first_name}} {{last_name}}</h2>
    <h2>{{first_name | upper}} {{last_name | lower}}</h2>
    <h2>{{some_list}}</h2>
    <h2>{{some_list.0}}</h2>
    <h2>{{some_list.1}}</h2>
    <h2>{{some_list.2}}</h2>
    <h2>{{some_dict}}</h2>
    <h2>{{some_dict.inside_key | upper}}</h2>
</body>
</html>