If you want to see the actual SQL generated by Django's ORM, you can print out the .query
attribute of a queryset. Here's an example with an app called home
and model called Question
that I generated in the Django shell:
$ python manage.py shell
(InteractiveConsole)
>>> from home.models import Question
>>> q = Question.objects.all()
>>> print(q.query)
SELECT "home_question"."id", "home_question"."date_added", "home_question"."question", "home_question"."number_of_answers" FROM "home_question"
Looking at the methods of django-datatable
, it looks like the filtered and paginated views are based on filtering the results of get_queryset
, which returns model.objects.all()
:
def get_queryset(self):
model = TableDataMap.get_model(self.token)
if model is None:
return None
return model.objects.all()