Let's say that we have the following model:
class Classroom(models.Model):
room_number = [...]
class Teacher(models.Model):
name = [...]
tenure = [...]
classroom = models.ForeignKey(Classroom)
Let's say that instead of getting a result like this per the ManyRelatedPrimaryKeyField function:
{
"room_number": "42",
"teachers": [
27,
24,
7
]
},
have it return something that includes the full related model representation like:
{
"room_number": "42",
"teachers": [
{
'id': 27,
'name': 'John',
'tenure': True
},
{
'id': 24,
'name': 'Sally',
'tenure': False
},
]
},
Is this possible? If so, how? And is this a bad idea?