Skip to content
This repository has been archived by the owner on Apr 5, 2024. It is now read-only.

Commit

Permalink
Merge pull request #695 from City-of-Helsinki/release/v0.10.1
Browse files Browse the repository at this point in the history
Release/v0.10.1
  • Loading branch information
tommimanbytes authored Mar 11, 2020
2 parents ff2be26 + e03d3a8 commit 46d09b0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
10 changes: 9 additions & 1 deletion resources/api/resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def parse_query_time_range(params):

def get_resource_reservations_queryset(begin, end):
qs = Reservation.objects.filter(begin__lte=end, end__gte=begin).current()
qs = qs.order_by('begin').prefetch_related('catering_orders').select_related('user')
qs = qs.order_by('begin').prefetch_related('catering_orders').select_related('user', 'order')
return qs


Expand Down Expand Up @@ -794,6 +794,14 @@ def get_serializer(self, page, *args, **kwargs):
def get_serializer_context(self):
context = super().get_serializer_context()
context.update(self._get_cache_context())

request_user = self.request.user
if request_user.is_authenticated:
prefetched_user = get_user_model().objects.prefetch_related('unit_authorizations', 'unit_group_authorizations__subject__members').\
get(pk=request_user.pk)

context['prefetched_user'] = prefetched_user

return context

def get_queryset(self):
Expand Down
2 changes: 1 addition & 1 deletion respa/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
__version__ = '0.10.0'
__version__ = '0.10.1'

VERSION = __version__

0 comments on commit 46d09b0

Please sign in to comment.