queryset with parameter
Closed this issue · 3 comments
Printns commented
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']
umesh-krishna commented
queryset
should hold a QuerySet
object.
objects.get()
returns a model Object. So, you should use objects.filter()
instead.
Printns commented
ok, thanks!
So, the parameter (id) can be transferred through class declaration as usual?
umesh-krishna commented
@Printns You should probably use something like queryset = models.Item.objects.filter(id=id).all()