I am trying to implement a to-do-list website to practice using Django. In models.py, I have a class called
Item to represent a to-do item. In it, I have the following line:
due_date = models.DateTimeField(required=False)
due_date is meant to be an optional field in case the user has a deadline for some to-do item. The problem is that the line above gives me a TypeError due to unexpected keyword argument 'required'.
So, it seems that I cannot use the keyword argument 'required' for DateTimeField. Is there any way I can make a DateTimeField optional? Or is there a standard implementation for the problem I am having?
"required" is a valid argument for Django forms. For models, you want the keyword args
blank=True (for the admin) and
null=True (for the database).