diff --git a/src/pypaperless/models/utils/__init__.py b/src/pypaperless/models/utils/__init__.py index 197b742..a0dfc20 100644 --- a/src/pypaperless/models/utils/__init__.py +++ b/src/pypaperless/models/utils/__init__.py @@ -39,7 +39,7 @@ def _str_to_date(datestr: str) -> date: def _dateobj_to_str(value: date | datetime) -> str: """Parse string from date objects.""" - return value.isoformat().replace("+00:00", "Z") + return value.isoformat() def object_to_dict_value(value: Any) -> Any: diff --git a/tests/data/v0_0_0.py b/tests/data/v0_0_0.py index 6689b1c..f053fbd 100644 --- a/tests/data/v0_0_0.py +++ b/tests/data/v0_0_0.py @@ -45,7 +45,7 @@ "matching_algorithm": 1, "is_insensitive": True, "document_count": 12, - "last_correspondence": "2022-10-18T00:00:00Z", + "last_correspondence": "2022-10-18T00:00:00+00:00", "owner": None, "user_can_change": True, }, @@ -57,7 +57,7 @@ "matching_algorithm": 1, "is_insensitive": True, "document_count": 6, - "last_correspondence": "2006-03-07T23:00:00Z", + "last_correspondence": "2006-03-07T23:00:00+00:00", "owner": None, "user_can_change": True, }, @@ -69,7 +69,7 @@ "matching_algorithm": 6, "is_insensitive": True, "document_count": 3, - "last_correspondence": "2022-03-11T00:00:00Z", + "last_correspondence": "2022-03-11T00:00:00+00:00", "owner": 3, "user_can_change": True, }, @@ -81,7 +81,7 @@ "matching_algorithm": 1, "is_insensitive": True, "document_count": 6, - "last_correspondence": "2000-07-18T22:00:00Z", + "last_correspondence": "2000-07-18T22:00:00+00:00", "owner": None, "user_can_change": True, }, @@ -93,7 +93,7 @@ "matching_algorithm": 2, "is_insensitive": True, "document_count": 20, - "last_correspondence": "2023-08-28T00:00:00Z", + "last_correspondence": "2023-08-28T00:00:00+00:00", "owner": None, "user_can_change": True, }, @@ -114,10 +114,10 @@ "title": "Crazy Document", "content": "some OCRd text", "tags": [], - "created": "2011-06-22T00:00:00Z", + "created": "2011-06-22T00:00:00+00:00", "created_date": "2011-06-22", - "modified": "2023-08-08T06:06:35.495972Z", - "added": "2023-06-30T05:44:14.317925Z", + "modified": "2023-08-08T06:06:35.495972+00:00", + "added": "2023-06-30T05:44:14.317925+00:00", "archive_serial_number": None, "original_file_name": "Scan_2023-06-29_113857.pdf", "archived_file_name": "2011-06-22 filename.pdf", @@ -134,10 +134,10 @@ "title": "Salty Document", "content": "OCRd text from document", "tags": [1], - "created": "2022-01-07T00:00:00Z", + "created": "2022-01-07T00:00:00+00:00", "created_date": "2022-01-07", - "modified": "2023-12-13T16:15:02.148852Z", - "added": "2022-02-12T11:34:50.072000Z", + "modified": "2023-12-13T16:15:02.148852+00:00", + "added": "2022-02-12T11:34:50.072000+00:00", "archive_serial_number": 1, "original_file_name": None, "archived_file_name": "2022-01-07.pdf", @@ -147,21 +147,21 @@ { "id": 1, "note": "Sample note 1.", - "created": "2023-12-21T18:08:11.481206Z", + "created": "2023-12-21T18:08:11.481206+00:00", "document": 2, "user": 1, }, { "id": 2, "note": "Sample note 2.", - "created": "2023-12-21T08:26:33.260968Z", + "created": "2023-12-21T08:26:33.260968+00:00", "document": 2, "user": 2, }, { "id": 3, "note": "Sample note 3.", - "created": "2023-12-21T08:26:31.782811Z", + "created": "2023-12-21T08:26:31.782811+00:00", "document": 2, "user": 3, }, @@ -194,10 +194,10 @@ "title": "Crazy Document", "content": "some OCRd text", "tags": [], - "created": "2011-06-22T00:00:00Z", + "created": "2011-06-22T00:00:00+00:00", "created_date": "2011-06-22", - "modified": "2023-08-08T06:06:35.495972Z", - "added": "2023-06-30T05:44:14.317925Z", + "modified": "2023-08-08T06:06:35.495972+00:00", + "added": "2023-06-30T05:44:14.317925+00:00", "archive_serial_number": None, "original_file_name": "Scan_2023-06-29_113857.pdf", "archived_file_name": "2011-06-22 filename.pdf", @@ -646,7 +646,7 @@ "id": 1, "task_id": "11112222-aaaa-bbbb-cccc-333344445555", "task_file_name": "a.png", - "date_created": "2023-12-16T13:06:29.107815Z", + "date_created": "2023-12-16T13:06:29.107815+00:00", "date_done": None, "type": "file", "status": "STARTED", @@ -658,8 +658,8 @@ "id": 2, "task_id": "ffffeeee-9999-8888-7777-ddddccccbbbb", "task_file_name": "b.png", - "date_created": "2023-12-16T13:06:26.117158Z", - "date_done": "2023-12-16T13:06:29.859669Z", + "date_created": "2023-12-16T13:06:26.117158+00:00", + "date_done": "2023-12-16T13:06:29.859669+00:00", "type": "file", "status": "SUCCESS", "result": "Success. New document id 1780 created", @@ -670,8 +670,8 @@ "id": 3, "task_id": "abcdef12-3456-7890-abcd-ef1234567890", "task_file_name": "c.png", - "date_created": "2023-12-16T13:04:28.175624Z", - "date_done": "2023-12-16T13:04:32.318797Z", + "date_created": "2023-12-16T13:04:28.175624+00:00", + "date_done": "2023-12-16T13:04:32.318797+00:00", "type": "file", "status": "SUCCESS", "result": "Success. New document id 1779 created", @@ -693,7 +693,7 @@ "password": "**********", "first_name": "", "last_name": "", - "date_joined": "2022-02-11T22:28:25Z", + "date_joined": "2022-02-11T22:28:25+00:00", "is_staff": True, "is_active": False, "is_superuser": False, @@ -708,7 +708,7 @@ "password": "**********", "first_name": "Alpha", "last_name": "Centauri", - "date_joined": "2023-06-27T15:59:01.975496Z", + "date_joined": "2023-06-27T15:59:01.975496+00:00", "is_staff": False, "is_active": True, "is_superuser": False, @@ -759,7 +759,7 @@ "password": "**********", "first_name": "Omega", "last_name": "Weapon", - "date_joined": "2022-02-14T13:42:54Z", + "date_joined": "2022-02-14T13:42:54+00:00", "is_staff": True, "is_active": True, "is_superuser": True, @@ -899,7 +899,7 @@ "password": "**********", "first_name": "", "last_name": "", - "date_joined": "2023-06-27T15:56:39.754859Z", + "date_joined": "2023-06-27T15:56:39.754859+00:00", "is_staff": False, "is_active": True, "is_superuser": False, diff --git a/tests/data/v1_17_0.py b/tests/data/v1_17_0.py index fd7513d..9c5c300 100644 --- a/tests/data/v1_17_0.py +++ b/tests/data/v1_17_0.py @@ -4,7 +4,7 @@ { "id": 1, "note": "Sample note 1.", - "created": "2023-12-21T18:08:11.481206Z", + "created": "2023-12-21T18:08:11.481206+00:00", "user": { "id": 1, "username": "test", @@ -15,7 +15,7 @@ { "id": 2, "note": "Sample note 2.", - "created": "2023-12-21T08:26:33.260968Z", + "created": "2023-12-21T08:26:33.260968+00:00", "user": { "id": 2, "username": "test", @@ -26,7 +26,7 @@ { "id": 3, "note": "Sample note 3.", - "created": "2023-12-21T08:26:31.782811Z", + "created": "2023-12-21T08:26:31.782811+00:00", "user": { "id": 3, "username": "test", diff --git a/tests/data/v2_0_0.py b/tests/data/v2_0_0.py index a590c3a..e9860f1 100644 --- a/tests/data/v2_0_0.py +++ b/tests/data/v2_0_0.py @@ -54,39 +54,39 @@ "results": [ { "id": 1, - "created": "2023-12-11T14:06:49.096456Z", - "expiration": "2023-12-18T14:06:49.064000Z", + "created": "2023-12-11T14:06:49.096456+00:00", + "expiration": "2023-12-18T14:06:49.064000+00:00", "slug": "GMIFR9WVPe7a0FAltmrAdmVsrrTzH6Z9yFi2jufhi5yCTAMWfF", "document": 1, "file_version": "original", }, { "id": 2, - "created": "2023-12-11T14:06:53.583496Z", - "expiration": "2024-01-10T14:06:53.558000Z", + "created": "2023-12-11T14:06:53.583496+00:00", + "expiration": "2024-01-10T14:06:53.558000+00:00", "slug": "Px2h3mrkIvExyTE8M8usrTLv3jtTb4MnLJ4eTAxcjy2FUmuDLq", "document": 2, "file_version": "original", }, { "id": 3, - "created": "2023-12-11T14:06:55.984583Z", + "created": "2023-12-11T14:06:55.984583+00:00", "expiration": None, - "slug": "bDnxeQ4UmlFVUYCDrb1KBLbE4HVSW8jw3CLElcwPyAncV5eiIz", + "slug": "bDnxeQ4UmlFVUYCDrb1KBLbE4HVSW8jw3CLElcwPyAncV5eiI+00:00", "document": 1, "file_version": "original", }, { "id": 4, - "created": "2023-12-11T14:07:01.448813Z", - "expiration": "2023-12-12T14:07:01.423000Z", + "created": "2023-12-11T14:07:01.448813+00:00", + "expiration": "2023-12-12T14:07:01.423000+00:00", "slug": "HfzHhDzA03ZQg4t4TAlOuup59qgQA18Zjbb9eOE06PZ8KTjgOb", "document": 2, "file_version": "archive", }, { "id": 5, - "created": "2023-12-11T14:11:50.710369Z", + "created": "2023-12-11T14:11:50.710369+00:00", "expiration": None, "slug": "7PIGEZbeFv5yIrnpSVwj1QeXiJu0IZCiEWGIV4aUHQrfUQtXne", "document": 1, @@ -94,7 +94,7 @@ }, { "id": 6, - "created": "2023-12-11T14:11:50.710369Z", + "created": "2023-12-11T14:11:50.710369+00:00", "expiration": None, "slug": "7PIGEZbeFv5yIrnpSVwj1QeXiJu0IZCiEWGIV4aUHQrfUQtXne", "document": 1, @@ -102,7 +102,7 @@ }, { "id": 7, - "created": "2023-12-11T14:11:50.710369Z", + "created": "2023-12-11T14:11:50.710369+00:00", "expiration": None, "slug": "7PIGEZbeFv5yIrnpSVwj1QeXiJu0IZCiEWGIV4aUHQrfUQtXne", "document": 1, @@ -110,7 +110,7 @@ }, { "id": 8, - "created": "2023-12-11T14:11:50.710369Z", + "created": "2023-12-11T14:11:50.710369+00:00", "expiration": None, "slug": "7PIGEZbeFv5yIrnpSVwj1QeXiJu0IZCiEWGIV4aUHQrfUQtXne", "document": 1, diff --git a/tests/data/v2_6_0.py b/tests/data/v2_6_0.py index fc3fc12..afc337f 100644 --- a/tests/data/v2_6_0.py +++ b/tests/data/v2_6_0.py @@ -29,7 +29,7 @@ "index_last_modified": "2024-03-06T07:10:55.370884+01:00", "index_error": None, "classifier_status": "OK", - "classifier_last_trained": "2024-03-06T07:05:01.281804Z", + "classifier_last_trained": "2024-03-06T07:05:01.281804+00:00", "classifier_error": None, }, }