title: Url arguments with Django ajax datatable?
body: <p>I have a template, usersummary.html. It shows details about a specific user by relying on a URL parameter. I'd like to display some of the data in a datatable, which would involve an AJAX datatable displaying data based on the same URL parameter.</p>
  
  <p>Using django-datatables-view:</p>
  
  <p>views.py:</p>
  
  <pre><code>from django_datatables_view.base_datatable_view import BaseDatatableView
  
  def usersummary(request, id):
      return render(request, 'app/usersummary.html')
  
  class testdatatableJSON(BaseDatatableView):
      model = User
      columns = ['item1', 'item2']
      # This class uses django-datatables-view
      # It returns JSON for the datatable to consume via AJAX
      # I'd like to filter it to display only data relating to the user id defined in the url for template usersummary.html
  </code></pre>
  
  <p>urls.py</p>
  
  <pre><code>url(r'^(?P&lt;id&gt;\d+)/$', views.usersummary, name='usersummary'),
  url(r'^testdatatable/$', testdatatableJSON.as_view(), name='testdatatable')
  </code></pre>
  
  <p>JS</p>
  
  <pre><code>$(document).ready(function() {
      $('#table').DataTable({
      "ajax": "{% url 'testdatatable' %}"
  # This controls table in usersummary.html template 
  </code></pre>
  
  <p>I'd thought that adding a method to the testdatatableJSON class like below would work, but alas not (presumably because the id parameter isn't actually passed in when consumed via AJAX). If I pass in a hard-coded example to test it, like "id=1", it works fine.</p>
  
  <pre><code>def get_initial_queryset(self, **kwargs):
      return User.objects.filter(id=self.kwargs['id'])
  </code></pre>
  
  <p>Any ideas?</p>
  
  <p>Thanks!</p>