From c1e9f282150b8a012c822656c52ad444b8b0888c Mon Sep 17 00:00:00 2001 From: "Christopher C. Wells" Date: Sun, 14 Aug 2022 12:24:27 -0700 Subject: [PATCH] Update tests for new datetime handling --- core/widgets.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/core/widgets.py b/core/widgets.py index e8af0f71..aaec4a6f 100644 --- a/core/widgets.py +++ b/core/widgets.py @@ -1,3 +1,4 @@ +import datetime from typing import Any, Dict, Optional from django.forms import Widget, RadioSelect, DateTimeInput as DateTimeInputBase @@ -110,4 +111,6 @@ class DateTimeInput(DateTimeInputBase): input_type = "datetime-local" def format_value(self, value): - return value.isoformat() + if isinstance(value, datetime.datetime): + value = value.isoformat() + return value