class MorchaDayView(viewsets.ViewSet): def retrieve(self, request, pk=None, date=None): self.widgets = Widgets(date=date, timespan='day', pk=pk, level='morcha') return Response({ 'count': self.widgets.total_count(), 'intrusions': self.widgets.get_intrusion_report(), 'area_secure': self.widgets.get_security_update() })
class MorchaDayView(viewsets.ViewSet): def retrieve(self, request, pk=None, date=None): self.widgets = Widgets(date=date, timespan='day', pk=pk, level='morcha') error, message = self.widgets.check_object_exists() if error: return Response(message, status=status.HTTP_400_BAD_REQUEST) else: return Response({ 'count': self.widgets.total_count(), 'intrusions': self.widgets.get_intrusion_report(), 'area_secure': self.widgets.get_security_update() })