title: Create dataTables in a Django application
body: <p>I have followed <a href="https://pypi.python.org/pypi/django-datatables-view" rel="nofollow">this tutorial</a> in order to add <strong>dataTables</strong> module to my django project, but I don't know how am I suposed to actually create that table on my <code>mytable.html</code> page.</p>
  
  <p><strong>models.py</strong>:</p>
  
  <pre><code>from django.db import models
  
  class SomeData(models.Model):
      first_name = models.CharField(max_length=30)
      last_name = models.CharField(max_length=30)
  </code></pre>
  
  <p>relevant part from <strong>views.py</strong>:</p>
  
  <pre><code>class OrderListJson(BaseDatatableView):
      model = SomeData
      columns = ['first_name', 'second_name']
      order_columns = ['first_name', 'second_name']
      max_display_length = 500
  
      def render_column(self, row, column):
          if column == 'user':
              return '{0} {1}'.format(row.customer_firstname, row.customer_lastname)
          else:
              return super(OrderListJson, self).render_column(row, column)
  
      def filter_queryset(self, qs):
          search = self.request.GET.get(u'search[value]', None)
          if search:
              qs = qs.filter(name__istartswith=search)
  </code></pre>
  
  <p><strong>urls.py</strong></p>
  
  <pre><code>from django.conf.urls import include, url
  from django.contrib import admin
  from proiect import views
  
  urlpatterns = [
      url(r'^admin/', include(admin.site.urls)),
      url(r'demo/', views.demo_page),
      url(r'tabel/$', views.mytable_page, name='order_list_json'), # something may be wrong here but I am not sure
  ]
  </code></pre>
  
  <p><strong>mytable.html</strong> (I don't know how to show the data in a table and how to actually print the table)</p>
  
  <pre><code>&lt;!doctype html&gt;
  &lt;meta charset="utf-8"&gt;
  &lt;title&gt;TablEs Demo&lt;/title&gt;
  &lt;head&gt;
      &lt;link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.5/css/bootstrap.css"&gt;
      &lt;link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/bootstrap-daterangepicker/2.0.7/daterangepicker.css"&gt;
      &lt;link rel="stylesheet" href="https://cdn.datatables.net/1.10.8/css/jquery.dataTables.min.css"&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
  
  &lt;script type="text/javascript" charset="utf8" src="//code.jquery.com/jquery-1.10.2.min.js"&gt;&lt;/script&gt;
  &lt;script src="//cdnjs.cloudflare.com/ajax/libs/moment.js/2.10.6/moment.min.js"&gt;&lt;/script&gt;
  &lt;script src="//cdnjs.cloudflare.com/ajax/libs/bootstrap-daterangepicker/2.0.7/daterangepicker.js"&gt;&lt;/script&gt;
  
  &lt;div class="container"&gt;
      &lt;div class="row"&gt;
          &lt;div class="col-sm-4"&gt;
                &lt;!--here I should have something to print the table and some data in it --&gt;
          &lt;/div&gt;
      &lt;/div&gt;
      &lt;script&gt;
      $(document).ready(function() {
        var oTable = $('.datatable').dataTable({
          "processing": true,
          "serverSide": true,
          "ajax": "{% url 'order_list_json' %}"
        });
      });
      &lt;/script&gt;
  &lt;/div&gt;
  &lt;/body&gt;
  </code></pre>