What's the best way to go about letting a frontend user know about ForeignKey field choices using Django Rest Framework? In the Browsable API these fields have a dropdown widget with all the existing objects as choices.
A custom metadata class could return the available choices for each field but the request could be very slow if there are millions of objects.
Suppose you have a model similar to below and there's only 5 unit objects. How would you go about listing the unit choices?
class OrderLine(models.Model):
order = models.ForeignKey(Order)
product = models.ForeignKey(Product)
unit = models.ForeignKey(Unit)