Why this ValidationError occur when deleting objects in Django model?

As far as I know, there are two ways to delete an object in the Django admin panel:

  1. delete one by one from the screen of each record -> Screen Transition
  2. delete items selected with check boxes from the record list screen -> Screen Transition

The following ValidationError occurs only when trying to delete with the second way and the object cannot be deleted. (see image below)

Please tell me how to fix this error.

ValidationError at /admin/my_app_name/schedule/
['“Oct. 2, 2022” value has an invalid date format. It must be in YYYY-MM-DD format.']

Below is the code that seems relevant.

# models.py
from django.db import models
from django.utils.timezone import now

class ScheduleType(models.Model):
    choices = (
        ('normal', 'normal'),
        ('am', 'am'),
    )
    schedule_type = models.CharField(max_length=32, choices=choices, primary_key=True)
    start_time = models.TimeField()
    end_time = models.TimeField()

class Schedule(models.Model):
    choices = (
        ('type1', 'type1'),
        ('type2', 'type2'),
    )
    date = models.DateField(default=now, primary_key=True)
    is_working = models.BooleanField(default=True)
    schedule_type = models.ForeignKey(ScheduleType, on_delete=models.SET_NULL, null=True)
    service1_type = models.CharField(max_length=32, choices=choices)
    offer_service2= models.BooleanField(default=True)
    offer_service3= models.BooleanField(default=True)
    info = models.CharField(max_length=128, default='This is a normal day.')

    def __str__(self):
        return str(self.date)
Back to Top