title: django check existence of template context variable
body: <p>I am writing a django template and I want to differentiate between the <strong>existence</strong> of a context variable vs it being None, empty etc. I've done my homework and it seems surprisingly hard. Specifically, this is what I'm trying to do</p>
  
  <pre><code>view 1:
  ...
  if some_condition = True:
      context['letters'] = ['a', 'b', 'c'] # The list might also be empty or None in some cases
  else
      context['numbers'] = [1, 2, 3] #This list might be empty or None in some cases
  
  Template
  ...
  &lt;ul&gt;
  {% if letters %}
      {% for x in letter %}
          &lt;li&gt;{{x}}&lt;/li&gt;
      {%endfor%}
  {% else %}
      {%for x in numbers%}
          &lt;li&gt;{{x}}&lt;/li&gt;
      {%endfor%}
  &lt;/ul&gt;
  </code></pre>
  
  <p>Using the <code>{% if %}</code> is dicey because it is fails if <code>letters</code> doesnt exist or the list is empty. I want to use <code>letters</code> even if it is empty (but defined in the context)</p>
  
  <p>I have the same problem with the built-in filters <code>default</code> and <code>default_if_none</code>
  How can I differentiate the existence of a context variable from it being other things like None or Empty </p>