프로그래밍/Python & dJango
[django] template tag "with" 사용법
bbuljj
2016. 9. 30. 11:03
1. django with 사용법
ex) a.html 을 include 함과 동시에 B.name 값을 넘기고자 한다.
{% include 'a.html' with name=B.name %}
위와 같이 작성하면 손쉽게 데이터를 보낼 수 있으며, 만약 여러개의 데이터를 보내려면
아래와 같이 작성하면 된다.
{% include 'a.html' with name=B.name age=B.age %}