10👍
Well, I have tested this app on my localhost, here is some results(too much for comment, so I will answer here)
First, you need to take a look here: http://django-datatable-view.appspot.com/
It has got some documentation about how to implement django-datatable-view. For example:
http://django-datatable-view.appspot.com/zero-configuration/ has got how to write a view to implement a table based on a model,
http://django-datatable-view.appspot.com/ordering/ has got how to get orders in table,
http://django-datatable-view.appspot.com/javascript-initialization/ has got information about js
.
Better if you clone the repo and run it in localhost. There you will be able to experiment with the views and templates(as I tried to do/did).
In here: https://github.com/pivotal-energy-solutions/django-datatable-view/blob/master/datatableview/tests/example_project/example_project/example_app/views.py, you will see how multiple types of view(For no configuration table, specific column table etc) has been coded.
Second, what have I tried so far:
My structure for this project was like this:
-Project
manage.py
-myapp(folder)
views.py
models.py
urls.py
-datatableview*(folder)
-projectapp(folder)
settings.py
urls.py
*From cloned repo, I copied datatableview folder and pasted it in my project.
In myapp>models:
class Post(models.Model):
title= models.CharField(max_length=150)
body = models.TextField()
created = models.DateField()
In myapp>views:
class MyView(DatatableView):
model = Post
datatable_options = {
'columns': [
'title',
'body',
'created',
]
}
In myapp>urls:
url(r'^$', MyView.as_view(), name='myview'),
In templates:
in (tempaltes/myapp/post_list.html)
{% block content %}
{{ datatable }}
{{ object_list }}
{% endblock %}
Result was like this:
title body created
[<post: one >, <post: two>]
here title body created
are names of table’s column header.
PS: I know its not much of a help, but hopefully this information will help you go further. And a little recommendation, please take a look at django-tables2