viewflow / django-material

Material Design for Django
http://viewflow.io/
BSD 3-Clause "New" or "Revised" License
2.48k stars 424 forks source link

if statement fetch all rows, slowdown #520

Closed rasulv closed 2 years ago

rasulv commented 2 years ago

material.frontend.views.list.DataTableMixin.get_data_attr line 220

please change to something like this: if hasattr(self, 'object_list') and self.object_list is not None:

https://github.com/viewflow/django-material/blob/615913ea86db35e56e518a772d317dc44f392f2b/material/frontend/views/list.py#L220

https://docs.djangoproject.com/en/4.0/ref/models/querysets/#when-querysets-are-evaluated

kmmbvnr commented 2 years ago

Thank you for good point! I wasn't able to spot the problem

Seems this fixes it? https://github.com/viewflow/django-material/commit/55561ac10e40c5e21bbc7fc42dba77a13b20384e