[Answered ]-Date field is not getting saved in Django Admin

1👍

The DATE_INPUT_FORMATS setting [Django-doc] expects an iterable of items, so:

DATE_INPUT_FORMATS = ['%Y-%m-%d']

or with a singleton tuple:

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

0👍

The tuple with only one value must have a trailing comma , as shown below:

DATE_INPUT_FORMATS = ('%Y-%m-%d',)
             # A trailing comma ↑

In addition, the tuple with multiple values can omit a trailing comma , as shown below:

DATE_INPUT_FORMATS = ('%Y-%m-%d', '%m-%Y-%d')
                        # No trailing comma ↑

Leave a comment