def openModel(request, *args, **kargs): file = str(request.query_params.get("file", "")) if file: activity_service = ActivityService(request) activity_service.registerOpenModel(file) service = ModelManagerService(request) model_info = service.openModel(file) serializer = ModelInfoSerializer(model_info) return Response(serializer.data) raise exceptions.NotAcceptable("Model file not found")
def get(request, *args, **kargs): dashboard_id = int(kargs.get("pk")) if dashboard_id: service = DashboardManagerService(request) dashboard = service.getDashboard(dashboard_id) activity_service = ActivityService(request) activity_service.registerOpenDashboard(dashboard) return Response( DashboardGetSerializer(dashboard, context={ 'request': request }).data) return Response(status=status.HTTP_404_NOT_FOUND)
def lastOpenDashboards(request, *args, **kargs): service = ActivityService(request) serializer = ActivitySerializer(service.lastDashboards(), many=True) return Response(serializer.data)