Problem:
I'm using Django Rest Framework and i want to fetch all models with the relationships included, like this:
TestModel.objects.all()
My model looks like this:
class TestModel(models.Model):
name = models.CharField(max_length=32)
related_model = models.ForeignKey(TestRelation)
Problem is, i only get the Primary Keys for related_model
but i need the whole related_model
!
I'm using the ListCreateAPIView, with the above queryset (TestModel.objects.all()
) and the most basic form of the ModelSerializer.
I tried the PrimaryKeyRelatedField
but i get the same result..
Thanks!