title: Merging tables from django-tables2 and dynamic models
body: <p>I would like to have a possibility on merging two or more tables (generated by <a href="https://github.com/bradleyayers/django-tables2" rel="nofollow">django-tables2</a>) which are generated from
  <a href="https://code.djangoproject.com/wiki/DynamicModels" rel="nofollow">dynamic models</a>.</p>
  
  <p>Let me first describe my problem:</p>
  
  <p>I have the following fields for a dynamically generated model:</p>
  
  <pre><code>...
  fields = {
      'colA': models.IntegerField(),
      'colB': models.IntegerField(),
      'colC': models.IntegerField(),
      'colD': models.IntegerField(),
  }
  ...
  </code></pre>
  
  <p>The dynamic handling gives me the possibility to store my tables structered, without defining redundant model classes.</p>
  
  <p>Example for models derived from stored tables in the database:</p>
  
  <pre><code>myDynamicModelA = DataModels().create_model('myDynamicModelA_tablename')
  myDynamicModelB = DataModels().create_model('myDynamicModelB_tablename')
  myDynamicModelC = DataModels().create_model('myDynamicModelC_tablename')
  myDynamicModelD = DataModels().create_model('myDynamicModelD_tablename')
  ....
  </code></pre>
  
  <p>'_tablename' is commonly shared by all tables. What differs is the prefix 'myDynamicModel A,B,C...'</p>
  
  <p>This is the model-part.</p>
  
  <p>According to that let me describe the table structure by using <em>django-tables2</em>:</p>
  
  <p>Each model/table shares some columns/fields, so that I can define a <em>django-tables2</em> class like this:</p>
  
  <pre><code>class Table_A(tables.Table):
      colA = tables.Column()
      colB = tables.Column()
  </code></pre>
  
  <p>The fields which are different can be handled simply by using inheritance:</p>
  
  <pre><code>class Table_B(Table_A):
      colC = tables.Column()
      colD = tables.Column()
  
      def __init__(self, *args, **kwargs):
          self.colname = kwargs['colname']
          kwargs.pop('colname')
          super(Table_B, self).__init__(*args, **kwargs)
          for col in self.base_columns:
              if col not in ['colA', 'colB']:
                  self.base_columns[col].verbose_name = '%s_%s' % (self.colname, col) 
  </code></pre>
  
  <p>As you can see, the constructor gives a different column-name-prefix for fields that differ across the models.</p>
  
  <p>Now it is possible to generate tables from the different models, eg:</p>
  
  <p><strong>Table for 'myDynamicModelA_tablename':</strong></p>
  
  <p>columns: colA, colB, myDynamicModelA_tablename_colC, myDynamicModelA_tablename_colD</p>
  
  <p><strong>Table for 'myGenericModelB_tablename':</strong></p>
  
  <p>columns: colA, colB, myDynamicModelB_tablename_colC, myDynamicModelB_tablename_colD</p>
  
  <p>...</p>
  
  <p>Now my question:
  is it possible to merge both tables so that I receive something like that:</p>
  
  <p>colA, colB, myDynamicModelA_tablename_colC, myDynamicModelB_tablename_colC, myDynamicModelA_tablename_colD, myDynamicModelB_tablename_colD</p>
  
  <p>The values which will be shown should result from an intersection between the tables (this is possible, because of the common values from colA, which could be interpreted as a <em>primary key</em>)</p>
  
  <p>It is nessecary that the result is a <em>django-tables2</em> object, because I want to provide pagination as well as sorting options.</p>
  
  <p>I hope my descriptions were understandable, sorry if not.</p>
  
  <p>Many thanks for your time and help.</p>