symposion_app/vendor/symposion/managers.py
2018-12-29 13:36:13 +13:00

16 lines
480 B
Python

from django.db.models import Manager
class DefaultSelectRelatedManager(Manager):
def get_queryset(self):
symposion_meta = getattr(self.model, 'SymposionMeta', None)
if symposion_meta is None:
return super().get_queryset()
select_related = getattr(symposion_meta, 'select_related', None)
if select_related is None:
return super().get_queryset()
return super().get_queryset().select_related(*select_related)