What is the equivalent of “none” in django templates?

后端 未结 7 914
孤街浪徒
孤街浪徒 2020-12-12 21:40

I want to see if a field/variable is none within a Django template. What is the correct syntax for that?

This is what I currently have:

{% if profile         


        
7条回答
  •  有刺的猬
    2020-12-12 22:04

    You can also use another built-in template default_if_none

    {{ profile.user.first_name|default_if_none:"--" }}
    

提交回复
热议问题