내가 하고 싶은 것들 중 하나

{% empty %} 템플릿 태그 본문

웹 세상/django

{% empty %} 템플릿 태그

여러가지이야기 2020. 4. 27. 12:00

template tag 정리

{% empty %} 가 무엇인지 알아보다가... (너무 쉬운건데 말이죠..)

{% for comment in review.comment_set.all %}
  <small> {{ comment.user }}</small>
  <div class='row mb-2'>
  <p class='col-11'>{{ comment.content }} </p>
  <a data-toggle="tooltip" data-placement="bottom" title="delete this comment" href = "{%url 'community:comment_delete' review.pk comment.pk %}" class='btn btn-outline-dark btn-sm col-1 font-weight-bolder'>x</a>
  </div>
{% empty %}
  <p> No comment yet! </p><br>
{% endfor %}
  • comment가 없을 경우 p태그를 출력합니다...?

  • 공식문서도 함께 봐주기

https://docs.djangoproject.com/en/3.0/ref/templates/builtins/

django 공식문서 Built-in template tags and filters

  • 아래 사이트에는 탬플릿 태그와 필터가 한국어로 잘 정리되어 있습니다.

https://goodmorningcody.wordpress.com/tag/django/

Basic Template Tags and Filters.

Comments