Skip to content

Commit 59633d9

Browse files
committed
Make created_at_local not have timezone field
1 parent 9156620 commit 59633d9

File tree

9 files changed

+13
-13
lines changed

9 files changed

+13
-13
lines changed

api/serializers.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -648,7 +648,7 @@ class Meta:
648648

649649
created_at = TimezoneAwareDateTimeField(required=True, source="creation_time")
650650
created_at_local = serializers.SerializerMethodField(
651-
help_text="The date and time when the record was created, displayed in the local timezone specified for this entry."
651+
help_text="The date and time when the record was created, displayed without timezone field."
652652
)
653653
sent_at = TimezoneAwareDateTimeField(required=True, source="phone_upload_time")
654654
published = serializers.SerializerMethodField()
@@ -659,7 +659,7 @@ class Meta:
659659
tags = TagListSerializerField(required=False, allow_empty=True)
660660

661661
def get_created_at_local(self, obj) -> datetime:
662-
return obj.creation_time_local
662+
return obj.creation_time_local.replace(tzinfo=None)
663663

664664
def get_published(self, obj) -> bool:
665665
return obj.published

api/tests/integration/bites/create.tavern.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ stages:
3939
Authorization: "Bearer {app_user_token:s}"
4040
method: "POST"
4141
data: &request_bite_data
42-
created_at: '2024-01-01T00:00:00Z'
42+
created_at: '2024-01-01T01:00:00+01:00'
4343
sent_at: '2024-01-01T00:30:00Z'
4444
location.point: !raw '{"latitude": 41.67419, "longitude": 2.79036}'
4545
location.source: 'auto'
@@ -58,7 +58,7 @@ stages:
5858
short_id: !anystr
5959
user_uuid: "{app_user.pk}"
6060
created_at: '2024-01-01T00:00:00Z'
61-
created_at_local: '2024-01-01T01:00:00+01:00'
61+
created_at_local: '2024-01-01T01:00:00'
6262
sent_at: '2024-01-01T00:30:00Z'
6363
received_at: !re_fullmatch \d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{6}Z
6464
updated_at: !re_fullmatch \d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{6}Z

api/tests/integration/bites/schema.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ variables:
1111
short_id: !anystr
1212
user_uuid: !re_fullmatch "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$"
1313
created_at: !re_fullmatch \d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{6}Z
14-
created_at_local: !re_fullmatch \d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{6}([+-]\d{2}:\d{2}|Z)
14+
created_at_local: !re_fullmatch \d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{6}
1515
sent_at: !re_fullmatch \d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{6}Z
1616
received_at: !re_fullmatch \d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{6}Z
1717
updated_at: !re_fullmatch \d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{6}Z

api/tests/integration/breeding_sites/create.tavern.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ stages:
4545
photos[0]file: "{test_jpg_image_path}"
4646
photos[1]file: "{test_png_image_path}"
4747
data: &request_site_data
48-
created_at: '2024-01-01T00:00:00Z'
48+
created_at: '2024-01-01T01:00:00+01:00'
4949
sent_at: '2024-01-01T00:30:00Z'
5050
location.point: !raw '{"latitude": 41.67419, "longitude": 2.79036}'
5151
location.source: 'auto'
@@ -62,7 +62,7 @@ stages:
6262
short_id: !anystr
6363
user_uuid: "{app_user.pk}"
6464
created_at: '2024-01-01T00:00:00Z'
65-
created_at_local: '2024-01-01T01:00:00+01:00'
65+
created_at_local: '2024-01-01T01:00:00'
6666
sent_at: '2024-01-01T00:30:00Z'
6767
received_at: !re_fullmatch \d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{6}Z
6868
updated_at: !re_fullmatch \d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{6}Z

api/tests/integration/breeding_sites/schema.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ variables:
1111
short_id: !anystr
1212
user_uuid: !re_fullmatch "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$"
1313
created_at: !re_fullmatch \d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{6}Z
14-
created_at_local: !re_fullmatch \d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{6}([+-]\d{2}:\d{2}|Z)
14+
created_at_local: !re_fullmatch \d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{6}
1515
sent_at: !re_fullmatch \d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{6}Z
1616
received_at: !re_fullmatch \d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{6}Z
1717
updated_at: !re_fullmatch \d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{6}Z

api/tests/integration/identification_tasks/assignments/schema.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ variables:
1313
uuid: !re_fullmatch "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$"
1414
locale: !anystr
1515
created_at: !re_fullmatch \d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{6}Z
16-
created_at_local: !re_fullmatch \d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{6}([+-]\d{2}:\d{2}|Z)
16+
created_at_local: !re_fullmatch \d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{6}
1717
received_at: !re_fullmatch \d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{6}Z
1818
location:
1919
timezone: !anything

api/tests/integration/identification_tasks/schema.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ variables:
1111
short_id: !anystr
1212
user_uuid: !re_fullmatch "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$"
1313
created_at: !re_fullmatch \d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{6}Z
14-
created_at_local: !re_fullmatch \d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{6}([+-]\d{2}:\d{2}|Z)
14+
created_at_local: !re_fullmatch \d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{6}
1515
received_at: !re_fullmatch \d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{6}Z
1616
location:
1717
timezone: !anything

api/tests/integration/observations/create.tavern.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ stages:
4545
photos[0]file: "{test_jpg_image_path}"
4646
photos[1]file: "{test_png_image_path}"
4747
data: &request_site_data
48-
created_at: '2024-01-01T00:00:00Z'
48+
created_at: '2024-01-01T01:00:00+01:00'
4949
sent_at: '2024-01-01T00:30:00Z'
5050
location.point: !raw '{"latitude": 41.67419, "longitude": 2.79036}'
5151
location.source: 'auto'
@@ -61,7 +61,7 @@ stages:
6161
short_id: !anystr
6262
user_uuid: "{app_user.pk}"
6363
created_at: '2024-01-01T00:00:00Z'
64-
created_at_local: '2024-01-01T01:00:00+01:00'
64+
created_at_local: '2024-01-01T01:00:00'
6565
sent_at: '2024-01-01T00:30:00Z'
6666
received_at: !re_fullmatch \d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{6}Z
6767
updated_at: !re_fullmatch \d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{6}Z

api/tests/integration/observations/schema.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ variables:
1111
short_id: !anystr
1212
user_uuid: !re_fullmatch "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$"
1313
created_at: !re_fullmatch \d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{6}Z
14-
created_at_local: !re_fullmatch \d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{6}([+-]\d{2}:\d{2}|Z)
14+
created_at_local: !re_fullmatch \d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{6}
1515
sent_at: !re_fullmatch \d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{6}Z
1616
received_at: !re_fullmatch \d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{6}Z
1717
updated_at: !re_fullmatch \d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{6}Z

0 commit comments

Comments
 (0)