[Answered ]-Dynamic choices in Foreignkey Field in Django Rest Framework

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.

Leave a comment