Multiple Serializer

57 views
Skip to first unread message

miguel angel lopez mendo

unread,
Dec 10, 2015, 3:37:54 PM12/10/15
to Django developers (Contributions to Django itself)
i have this serializers 

class ValuarCoche(serializers.ModelSerializer):
class Meta:
model = Valuacion
depth = 6
fields = ('coche','Precio_Venta','Precio_Compra')

class CocheSerializer2(serializers.ModelSerializer):
valuacion = ValuarCoche(many=True)
class Meta:
model = Coche


        fields = ('id', 'marca', 'modelo', 'version', 'estado','anio','timestamp','valuacion')


but don't work  i need that print 


{
        "id": 3,
        "marca": {
            "id": 1,
            "nombre": "Acura"
        },
        "modelo": {
            "id": 1,
            "nombre": "ILX"
        },
        "version": "a5",
        "estado": "1",
        "anio": 2015,
        "timestamp": "2015-12-08T19:12:05.887126Z"
         "Precio_Venta": 0,
        "Precio_Compra": 0
    },


the error is the next 

Tim Graham

unread,
Dec 10, 2015, 3:50:35 PM12/10/15
to Django developers (Contributions to Django itself)
Please don't cross post messages like this to django-developers and django-users. The latter is the appropriate mailing list for questions like this.
Reply all
Reply to author
Forward
0 new messages