morlandi / django-ajax-datatable

A Django app which provides the integration of a Django project with the jQuery Javascript library DataTables.net
MIT License
208 stars 64 forks source link

Support for ManyToMany fields #15

Closed morlandi closed 2 years ago

morlandi commented 3 years ago

By now, it's very limited; what I'm doing in the example project is:

Some specific code is needed in build_column_filter() to allow searching, based on some variation of the following snippet:

tags = Tag.objects.filter(name__in=[search_value, ]), or Tag.objects.filter(name__icontains=search_value) ???
then:
queryset = queryset.filter(tags__in=tags)

For this to work, an indication of the field to be used in the related Model ("name" in the example above) must the supplied (probably in 'foreign_field' attribute)