'Getting Error while entering the date input in the Admin Database

model.py

class Add_Timelog(models.Model):
    
    
    project=models.ManyToManyField(Project)
    client=models.ManyToManyField(Client)
    Job=models.ManyToManyField(Add_Job)
    Date = models.DateTimeField(max_length=100)
    Hours=models.TimeField(Date,null=True)
    
    def __str__(self):
        return str(self.Date)

Settings.py

DATE_INPUT_FORMATS = ('%Y-%m-%d')

While I entered the Date in the admin database it is showing as an undefined in the field and throwing an error as an "enter a valid date". I have changed the formats and entered the date manually in the Date field based on the format mentioned, but still throwing error.

enter image description here



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source