shymonk/django-datatable

ajax and custom queryset

pix106 opened this issue · 2 comments

Hi,

i would like to use this module to show a very large amount of members of a group, with search using AJAX.

In the documentation, i saw the "static" filtered queryset "id__gt=5" in the example, but i would like it to be dynamic, using the group_id from GET in the URL.

Ex :
I have a view that shows the members : http://myapp/showmembers/[group_id]

I don't understand how to use the group_id from the URL to build a dynamic queryset when using ajax, so i only see the members of the group i'm looking at.

I need help please guys :)
Thanks.

Hi,
no one can tell me what i am missing ?
Thanks

Hi,
no one can tell me what i am missing ?
Thanks

it works when i pass the [hosttype_id] to a seesion like below:
print('hosttype_id ' + str(self.request.session.get('hosttype_id')))
return super(pcDataView, self).get_queryset().filter(
Q(site_id=self.request.user.adm_info.site_id) & (Q(hosttype=self.request.session.get('hosttype_id'))))