[Fixed]-"Enter a valid date" error in django when I edit the form

1👍

The type of fields expire_date and start_date in the model does not match their type in the form.

The values get stored as DateTime instead of Date.

In your model change start_date and expiry_date to DateField

class Promotions(models.Model):
    name = models.CharField(max_length=100)
    description = models.CharField(max_length=10000)
    status = models.CharField(max_length=100)
    website = models.CharField(max_length=100)
    start_date = models.DateField()
    expire_date = models.DateField()

Leave a comment