diff --git a/vera/params/rest.py b/vera/params/rest.py index 6c6d518..86b15ee 100644 --- a/vera/params/rest.py +++ b/vera/params/rest.py @@ -10,14 +10,17 @@ Site, serializer=patterns.IdentifiedModelSerializer, fields="__all__", + cache="all", ) rest.router.register_model( ReportStatus, serializer=patterns.IdentifiedModelSerializer, fields="__all__", + cache="all", ) rest.router.register_model( Parameter, serializer=patterns.IdentifiedModelSerializer, fields="__all__", + cache="all", ) diff --git a/vera/series/rest.py b/vera/series/rest.py index de92583..ba5b662 100644 --- a/vera/series/rest.py +++ b/vera/series/rest.py @@ -2,6 +2,13 @@ import swapper from .serializers import EventSerializer, ReportSerializer + +def user_filter(qs, request): + if request.user.is_authenticated(): + return qs.filter(user=request.user) + else: + return qs.none() + Event = swapper.load_model('series', 'Event') Report = swapper.load_model('series', 'Report') @@ -9,17 +16,11 @@ Event, serializer=EventSerializer, fields="__all__", - - max_local_pages=1, - partial=True, - reversed=True, + cache="none", ) rest.router.register_model( Report, serializer=ReportSerializer, fields="__all__", - - max_local_pages=1, - partial=True, - reversed=True, + cache_filter=user_filter, )