symposion_app/vendor/symposion/symposion/managers.py
Ben Sturmfels 34509d23eb
Make vendored symposion into an installable Python package
This allows us to install with `pip install "-e vendor/symposion"` similar to
the other vendored packages. There's no good reason for this to be different to
the others and depend on PYTHONPATH hacking.

Re-add
2023-04-24 16:38:25 +10: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)