I have the following django models
class Cast(models.Model):
coordinates = models.PointField()
class CastImage(models.Model):
image = models.ImageField(upload_to="castimages")
cast = models.ForeignKey(Cast, blank=True, null=True, related_name='images')
and the following serializer
class CastSerializer(serializers.ModelSerializer):
images = serializers.RelatedField(many=True)
class Meta:
model = Cast
fields = ('images',)
This all seems quite similar to what can be found in the doc: http://www.django-rest-framework.org/api-guide/relations#relatedfield
but when I test the serializer for the Cast object, although there really are images for those Cast objects (I checked), I only get empty images lists:
"results": [
{
"images": []
},
{
"images": []
},
{
"images": []
} ]
What am I missing ?
model = CastImage?