title: django-table2: Table subclassing and Meta inner class attributes
body: <p>I'm trying to create a generic table view, that take a model and a tuple of columns names, and show the given columns of the model. My problem is with inner Meta class.</p>
  
  <p>Assume this two models:</p>
  
  <pre><code># models.py
  
  from django.db import models
  
  
  class Model_a(models.Model):
      column_a_1 = models.Field() 
      column_a_2 = models.Field()
      column_a_3 = models.Field()
      column_a_4 = models.Field()
      column_a_5 = models.Field()
  
  
  class Model_b(models.Model):
      column_b_1 = models.Field() 
      column_b_2 = models.Field()
      column_b_3 = models.Field()
      column_b_4 = models.Field()
      column_b_5 = models.Field()
  </code></pre>
  
  <p>The objective is to have a single view that generates the right table with some of the columns in a given order. So, I've a urls.py like this:</p>
  
  <pre><code># urls.py
  
  from django.conf.urls import patterns, url
  import myapp.views as myviews
  import myapp.models as mymodels
  
  
  urlpatterns = patterns( '',
                         url( r'^table_a/$',
                              myviews.show_table,
                              { 'model': mymodels.Model_a,
                                'columns': ("column_a_1", "column_a_2", "column_a_3") } ),
                         url( r'^table_b/$',
                              myviews.show_table,
                              { 'model': mymodels.Model_b,
                                'columns': ("column_b_5", "column_b_2") } ) )
  </code></pre>
  
  <p>And a simple views.py like this:</p>
  
  <pre><code># views.py
  
  from django.shortcuts import render
  from django_tables2 import RequestConfig
  import myapp.tables as mytables
  
  
  def show_table(request, model, columns):
      entries = model.objects.all()
      table = mytables.ModelTable(entries, model, columns)
      RequestConfig(request).configure(table)
      return render(request, 'table_view.html', {'dynamic-table': table})
  </code></pre>
  
  <p>The key is in the Table subclassing, inside tables.py:</p>
  
  <pre><code># tables.py
  
  from django_tables2 import import Table
  
  
  class ModelTable(Table):
  
      class Meta:
          pass
  
      def __init__(self, data, model, columns, order_by=None, orderable=None, empty_text=None,
                   exclude=None, attrs=None, sequence=None, prefix=None,
                   order_by_field=None, page_field=None, per_page_field=None,
                   template=None, sortable=None, default=None):
          self.Meta.model = model
          self.Meta.fields = columns
          self.Meta.sequence = columns
          super(ModelTable, self).__init__(data, order_by, orderable, empty_text,
                   exclude, attrs, sequence, prefix,
                   order_by_field, page_field, per_page_field,
                   template, sortable, default)
  </code></pre>
  
  <p>Clearly, I didn't understand how to set attributes, of Table.Meta, from the Table subclass initializer.
  The courious thing is that when I use <code>{% render_table dynamic-table %}</code> in my template, I get en empty table (so not visible), but a well working paginator.</p>
  
  <p>Where is my mistake?</p>