Metadata-Version: 2.4
Name: django-datatablesview
Version: 0.10.1
Summary: A Django app that integrates with DataTables.net javascript api.
Project-URL: Homepage, https://github.com/dahlkar/django-datatables
Author-email: Dahlkar <johan.dahlkar@gmail.com>
License-File: LICENSE
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Requires-Python: >=3.6
Requires-Dist: django>=2.1
Description-Content-Type: text/markdown

# Datatables
Datatables is a Django app that which gives the possibility to create
views that integrates with the jQuery javascript library DataTables.

It also includes some features which makes it possible to export data to a csv
from the table.


## Installation
Add `'datatables'` to your `INSTALLED_APPS` setting like this:

``` python
    INSTALLED_APPS = [
        ...
        'datatables',
    ]
```

## Usage

1. Create a view:
``` python
from datatables.views import DatatableView
from someapp.models import MyModel


class ExampleView(DatatableView):
    model = MyModel
    columns = [
        'field1',
        'field2',
        'custom_data',
    ]

    def custom_data(self, obj):
        return 'some custom data'
```

2. Add css and js to template:
`example.html`
``` html
{% load datatables %}

<html>
    <head>
    {% css_bundle %}
    </head>
    <body>
    {{ datatable }}
    </body>
    {% js_bundle %}
</html>
```
