Skip to content
This repository has been archived by the owner on Oct 22, 2024. It is now read-only.

a1fred/django-datatables-views

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Installation

pip install django-datatables-views

Usage example

views.py:

# coding=utf-8
from datatables_views.cbv import DataTableListView


class MyModelListVIew(DataTableListView):
    template_name = 'list.html'
    queryset = models.Mymodel.objects.filter(deleted=False)
    dt_fields = [
        DTColumn(
            u"Name",
            searching=True,
            hidden=False,
            render_func=lambda m: "<a href='%s'>%s</a>" % (m.get_absolute_url(), unicode(m))
        ),
        DTColumn(
            u"Creation date",
            searching=False,
            hidden=False,
            render_func=lambda m: str(m.created)
        ),
        DTColumn(
            u"Type",
            searching=True,
            hidden=False,
            search_choices=["choice1", "choice2", "choice3"]
            render_func=lambda m: str(m.created)
        ),

About

CBV for easy table views construction with datatables (https://www.datatables.net/) library

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published