[Answered ]-Customized dropdown value based on foreign key in django admin

1👍

To customize dropdown text, you should implement the standard _ _ str _ _ method in the relevant model:

class VarientSubField(models.Model):
   select_Varient = models.ForeignKey(Varient, on_delete=models.CASCADE)
   name = models.CharField(max_length=200)

def __str__(self):
   return self.select_Varient.category + " - " + self.select_Varient.varient_name + " - " + self.name

Leave a comment