Live demo

blog headline Publication date n comments rating


Description

By converting a column's definition to a 2-tuple, you can specify a verbose name that should appear as the column header. In this example, the pub_date field has been given a special verbose name "Publication date".

This becomes particularly useful when the field is virtualized (i.e., not tied to a specific model field).



Implementation in code

        
    class PrettyNamesDatatableView(DatatableView):
        model = Entry
        datatable_options = {
            'columns': [
                'blog',
                'headline',
                ("Publication date", 'pub_date'),
                'n_comments',
                'rating',
            ]
        }