Skip to content

Commit

Permalink
update cache settings
Browse files Browse the repository at this point in the history
  • Loading branch information
sheppard committed Apr 13, 2017
1 parent f5a1287 commit 79e58ca
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
3 changes: 3 additions & 0 deletions vera/params/rest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
)
17 changes: 9 additions & 8 deletions vera/series/rest.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,25 @@
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')

rest.router.register_model(
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,
)

0 comments on commit 79e58ca

Please sign in to comment.