Live demo

ID blog headline body text pub date mod date n comments n pingbacks rating


If no columns are specified in the view's datatable_options attribute, DatatableView will use all of the model's local fields. Note that this does not include reverse relationships, many-to-many fields (even if the ManyToManyField is defined on the model directly), or the special pk field.

Note that fields will attempt to use their verbose_name, if available.

Having ForeignKey as a visible column will generate extra queries per displayed row, due to the way attribute lookup will cause Django to go fetch the related object. Implement a get_queryset() method on your view that returns a queryset with the appropriate call to select_related().

Implementation in code

    class ZeroConfigurationDatatableView(DatatableView):
        model = Entry