title: How to check if a field/attribute is null and blank in Django?
body: <p>My payment attribute has a ForeignKey relation. In my accounts.html, I want to show users if they have paid for their orders. So I was trying it like this:</p>
  
  <pre><code>{% if order.payment is null or blank %}
      &lt;td&gt; x&lt;/td&gt;
  {% else %}
      &lt;td&gt; Yes&lt;/td&gt;
  {% endif %}
  </code></pre>
  
  <p>But it didn't work out. What is the proper code for this?</p>
  
  <p>My orders.models.py:</p>
  
  <pre><code>class Order(models.Model):
      payment = models.ForeignKey(Payment, on_delete=models.SET_NULL, blank= True, null=True)
  </code></pre>
  
  <p>My accounts.html:</p>
  
  <pre><code>{% for order in user.order_set.all %}
      &lt;tbody&gt;
        &lt;tr&gt;
          &lt;th scope="row"&gt;{{ forloop.counter }}&lt;/th&gt;
            &lt;td&gt;{{ order.order_id }}&lt;/td&gt;
              {% if order.payment is null or blank %}
                &lt;td&gt; x&lt;/td&gt;
              {% else %}
                &lt;td&gt; Yes&lt;/td&gt;
              {% endif %}
              &lt;td&gt;No&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
  {% endfor %}
  </code></pre>