2👍
✅
I think you’re looking for this part of the DRF documentation.
Basically, your Django model’s own representation is used. So for example, in your Student
model you can add __str__
method:
# this is for Python 3, use __unicode__ on Python 2
def __str__(self):
return self.name
Meta options documentation for Django is here, look for model methods.
Source:stackexchange.com