OpenSlides/server/openslides/utils/manager.py
FinnStutzenstein 2bcab5d098
Repository restructure
- moved all server related things into the folder `server`, so this
configuration is parallel to the client.
- All main "services" are now folders in the root directory
- Added Dockerfiles to each service (currently server and client)
- Added a docker compose configuration to start everything together.
Currently there are heavy dependencies into https://github.com/OpenSlides/openslides-docker-compose
- Resturctured the .gitignore. If someone needs something excluded,
please add it to the right section.
- Added initial build setup with Docker and docker-compose.
- removed setup.py. We won't deliver OpenSlides via pip anymore.
2020-08-21 08:11:13 +02:00

21 lines
623 B
Python

from typing import Any, List, Optional
from django.db.models import Manager, QuerySet
class BaseManager(Manager):
"""
A base manager for all REST-models.
Provides a base implementation for `get_prefetched_queryset` and
allows filtering of the queryset by ids.
"""
def get_queryset(self, ids: Optional[List[int]] = None) -> QuerySet:
queryset = super().get_queryset()
if ids:
queryset = queryset.filter(pk__in=ids)
return queryset
def get_prefetched_queryset(self, *args: Any, **kwargs: Any) -> QuerySet:
return self.get_queryset(*args, **kwargs)