0

For some reason, the default value for a Django model field I have doesn't work. As in, if the value is left blank by the user when creating an object for that model, then when the value is used in a template, it shows on the website as blank as opposed to the default value. Why is this?

models.py:

(the category field)

class Auction(models.Model):
    username = models.CharField(max_length=50)
    title = models.CharField(max_length=64)
    price = models.CharField(max_length=64)
    description = models.CharField(max_length=100)
    creation_date = models.DateTimeField()
    photo = models.FileField(null=True, blank=True)
    category = models.CharField(max_length=64, default="No category listed")
    active = models.BooleanField(default=True)
    winner = models.CharField(max_length=50, blank=True)

(This is for project 2 - commerce)

Thank you!

You must log in to answer this question.

Browse other questions tagged .