django-datatables-pagination

A Django ListView integration with datatables library.


Keywords
django, datatables, pagination
License
MIT
Install
pip install django-datatables-pagination==0.1.5

Documentation

how to install

pip install django-datatables-pagination

example

ListView

class MyListView(DtPaginatedListView):
    model = MyModel
    tr_template = 'core/tr.html'
    # searchable fields 
    filtered_fields = ('id', 'field1', 'fiild2')

tr.html

<td>{{object.id}}</td>
<td>{{object.field2}}</td>
<td>{{object.field2}}</td>

mymodel_list.html

{% block content %}
    <table class="datatable">
        <tr>
            <th>id</th>
            <th>field1</th>
            <th>field2</th>
        </tr>
    </table>
{% endblock %}

{% block scripts %}
    {% include 'django_datatables_pagination/datatables_setup.html' %}
{% endblock %}