title: how to check django_tables2 object empty/null?
body: <p>The problem I'm trying to solve:<br>
  Display a search bar only when the table <code>my_table</code> is not empty, else, hide it.</p>
  
  <p>Here's my views.py:</p>
  
  <pre><code>def my_table(request):
      model1 = Model1.objects.all().filter(Q(some_query))
      table = MyTable(model1)
      RequestConfig(request).configure(table)
      if not table:
          print "table is empty"
          table = None
      else:
          print "table is not empty."
      return render(request, 'my_table.html', {'my_table':table,})
  </code></pre>
  
  <p>Here's my <code>my_table.html</code>:</p>
  
  <pre><code>{% load render_table from django_tables2 %}
  {% if my_table  %}
  Number of entries: {{ my_table|length }}.
  &lt;section&gt;
      &lt;form method="post" action="."&gt;
        {% csrf_token %}
        &lt;input type="text" class="search-query span80" id="search" name="search" placeholder="Type to search"&gt;
        &lt;button type="submit" class="btn"&gt;Search&lt;/button&gt; 
      &lt;/form&gt;
  &lt;/section&gt;
  {% else %}
  &lt;!-- There's no my_table. --&gt;
  {% endif%}
  
  {% render_table my_table %}
  </code></pre>
  
  <p>However, this table object in <code>my_table(request)</code> views.py contains really nothing, and it doesn't render anything in the html, but it's just not empty, and displays the search bar.<br>
  Please advise. Where I'm doing it wrong?</p>
  
  <p>In response to comments, here's MyTable code:</p>
  
  <pre><code>class MyTable(tables.Table):
      entry1 = tables.Column(verbose_name="Entry 1")
      entry2 = tables.Column(verbose_name="Entry 2")
      class Meta:
          model = MyModel
          empty_text = "There is no entry record."
          order_by = "entry1"
          orderable = True
          sequence = ('entry1', 'entry2')
          fields = ('entry1', 'entry2')
          attrs = {"class": "paleblue", "style": "width:380px"}
  </code></pre>
  
  <p>And here's the code for MyModel:</p>
  
  <pre><code>class MyModel(models.Model):
      entry1 = models.CharField(primary_key=True, max_length=11L, db_column='Entry1', blank=True) # Field name made lowercase.
      entry2 = models.CharField(max_length=11L, db_column='Entry2', blank=True) # Field name made lowercase.
  class Meta:
      db_table = 'my_table'
  </code></pre>