Exemplo n.º 1
0
def create_circle(request):
    #Create circle

    serializer = CreateCircleSerializer(data=request.data)
    serializer.is_valid(raise_exception=True)
    circle = serializer.save()
    # data = serializer.data
    # circle = Circle.objects.create(**data)

    # name = request.data['name']
    # slug_name = request.data['slug_name']
    # name = request.data['name']
    # about = request.data.get('about','')

    # circle = Circle.objects.create(name=name, slug_name=slug_name, about=about)

    # data = {
    # 	'name'          : circle.name,
    # 	'slug_name'     : circle.slug_name,
    # 	'rides_taken'   : circle.rides_taken,
    # 	'rides_offered' : circle.rides_offered,
    # 	'members_limit' : circle.members_limit,
    # }

    return Response(CircleSerializer(circle).data)
Exemplo n.º 2
0
def create_circle(request):
    """ Create circle. """
    serializer = CreateCircleSerializer(data=request.data)
    serializer.is_valid(raise_exception=True)
    circle = serializer.save()

    return Response(CircleSerializer(circle).data)
Exemplo n.º 3
0
def circle_list(request):
    """
    :param request:
    :return:
    """
    circuilos = Circle.objects.filter(is_public=True)
    serializer = CircleSerializer(circuilos, many=True)
    return Response(serializer.data)
Exemplo n.º 4
0
def create_circle(request):
    """Crea circle"""
    serializer = CreateCircleSerializer(
        data=request.data)  #recibe los datos y los envia al serializer
    serializer.is_valid(raise_exception=True)
    circle = serializer.save()

    return Response(CircleSerializer(circle).data)
Exemplo n.º 5
0
def list_circles(request):
    circles = Circle.objects.filter(is_public=True)
    serializer = CircleSerializer(circles, many=True)
    # data = []
    # for circle in circles:
    # 	# data.append({
    # 	# 	'name'          : circle.name,
    # 	# 	'slug_name'     : circle.slug_name,
    # 	# 	'rides_taken'   : circle.rides_taken,
    # 	# 	'rides_offered' : circle.rides_offered,
    # 	# 	'members_limit' : circle.members_limit,
    # 	# })
    # 	serializer = CircleSerializer(circle)
    # 	data.append(serializer.data)
    # return Response(data)
    return Response(serializer.data)
Exemplo n.º 6
0
def list_circles(request):
    """List circles."""
    circles = Circle.objects.filter(is_public=True)
    serializer = CircleSerializer(circles, many=True)
    return Response(serializer.data)
Exemplo n.º 7
0
def list_circles(request):
    """List circles"""
    circles = Circle.objects.filter(is_public=True)
    #data = [CircleSerializer(circle).data for circle in circles]
    serializer = CircleSerializer(circles, many=True)
    return Response(serializer.data)