Exemplo n.º 1
0
 def render(self, data, media_type=None, renderer_context=None):
     if not renderer_context or renderer_context['response'].status_code == 404:
         return bytes()
     if renderer_context['view'].action == 'retrieve':
         return generate_reservation_xlsx([data])
     elif renderer_context['view'].action == 'list':
         return generate_reservation_xlsx(data['results'])
     else:
         return NotAcceptable()
Exemplo n.º 2
0
 def render(self, data, media_type=None, renderer_context=None):
     if not renderer_context or renderer_context['response'].status_code == 404:
         return bytes()
     if renderer_context['view'].action == 'retrieve':
         return generate_reservation_xlsx([data])
     elif renderer_context['view'].action == 'list':
         return generate_reservation_xlsx(data['results'])
     else:
         return NotAcceptable()