Re: django restframework relation

2018-03-14 Thread Leif
Hi Jason, Thank you fo rthe quick reply. Did you mean to create XyzSerializer like this? class XyzSerializer(serializers.ModelSerializer): tracks = TrackSerializer(many=True, read_only=True) when you said "do the same in TrackSerializer" did you mean 'reverse relation'? How to do reverse re

Re: django restframework relation

2018-03-14 Thread Jason
OK, first, you're using the old docs. DRF has long been version 3 and those docs are v2.x. The correct location is http://www.django-rest-framework.org/api-guide/relations/ Secondly, follow the example of how AlbumSerializer includes TrackSerializer, and do the same in TrackSerializer. On W

django restframework relation

2018-03-14 Thread Leif
Dear Django, I have a question about django rest framework relations. I am looking at the example in http://www.tomchristie.com/rest-framework-2-docs/api-guide/relations. In my situation there is additional class called Xyz: class Xyz(models.Model): xyz_name = models.CharField(max_length=1