mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-08-28 01:26:14 +00:00
Fix: accept datetime for created (#10021)
This commit is contained in:
@@ -965,6 +965,20 @@ class DocumentSerializer(
|
||||
).isoformat()
|
||||
return doc
|
||||
|
||||
def to_internal_value(self, data):
|
||||
if (
|
||||
"created" in data
|
||||
and isinstance(data["created"], str)
|
||||
and ":" in data["created"]
|
||||
):
|
||||
# Handle old format of isoformat datetime string
|
||||
try:
|
||||
data["created"] = datetime.fromisoformat(data["created"]).date()
|
||||
except ValueError: # pragma: no cover
|
||||
# Just pass, validation will catch it
|
||||
pass
|
||||
return super().to_internal_value(data)
|
||||
|
||||
def validate(self, attrs):
|
||||
if (
|
||||
"archive_serial_number" in attrs
|
||||
|
Reference in New Issue
Block a user