def get(self, request): app_props = ['name', 'key'] app_list = [] apps = CloudApp.objects.all() for app in apps: new_app = {} for prop in app_props: new_app[prop] = getattr(app, prop) app_list.append(new_app) return Response(paginate(request, app_list))
def get(self, request, *args, **kwargs): app_users = AppUser.objects.filter(app = request.app) users = [app_user.user for app_user in app_users] serializer = UserSerializer(users, many=True) return Response(paginate(request, serializer.data))
def get(self, request): app_classes = manager.get_classes(request.app.name) return Response(paginate(request, app_classes))
assert(len(order_obj) == 1) # sorting possible only on one key order_by = order_obj.keys()[0] order = order_obj.values()[0] except AssertionError: return Response({'error': 'orderby option takes only one property value'}, status=status.HTTP_400_BAD_REQUEST, exception=True) except Exception, e: order_by = order = None try: res = manager.get_class(request.app.name, cls, query, order_by, order) except Exception, e: return Response({'error': str(e)}, status=status.HTTP_500_INTERNAL_SERVER_ERROR, exception=True) return Response(paginate(request, res)) def delete(self, request, cls): manager.delete_class( request.app.name, cls) return Response({"result" : "The class was deleted successfully"}) def post(self, request, cls): try: objid = manager.add_object(request.app.name, cls, request.DATA) except InvalidObjectError: return Response({"error": "Invalid object"}, status= status.HTTP_400_BAD_REQUEST) except InvalidSchemaError as e: return Response({"error": str(e)}, status= status.HTTP_400_BAD_REQUEST) except Exception as e: