[Answer]-How to show a custom <option> text in a queryset field from forms in Django?

1👍

You can use the __unicode__ attribute

def Product(models.Model):
    thename = models.CharField(max_length=50)
    unity = models.CharField(max_length=50)
    price = models.DecimalField(max_digits=10, decimal_places=2, default=0)

    def __unicode__(self):
        return "%s - %s - %s"%(self.thename, self.unity, self.price)

Now, render the form the way you would normally

Leave a comment