[Django]-Why my model field doesn't read the value of its ForeignKey, it returns its object number instead?

3👍

You should implement the __str__ method to decide how to render the objects (Diagnosis in this case):

class Diagnosis(models.Model):
    diagnosis=models.CharField(max_length=30, blank=True)

    def __str__(self):
        return self.diagnosis

Leave a comment