umesh-krishna/django_serverside_datatable

queryset with parameter

Closed this issue · 3 comments

Is it possible to use view.py with parameter like this:

from django_serverside_datatable.views import ServerSideDatatableView

class ItemListView(ServerSideDatatableView, id):
queryset = models.Item.objects.get(id)
columns = ['name', 'code', 'description']

queryset should hold a QuerySet object.
objects.get() returns a model Object. So, you should use objects.filter() instead.

ok, thanks!
So, the parameter (id) can be transferred through class declaration as usual?

@Printns You should probably use something like queryset = models.Item.objects.filter(id=id).all()