Skip to content

Commit 3a699c2

Browse files
authored
Merge pull request #321 from Mosquito-Alert/api_created_at_local_without_tz
Make created_at_local not have timezone field
2 parents 17a023c + 59633d9 commit 3a699c2

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
@@ -664,7 +664,7 @@ class Meta:
664664

665665
created_at = TimezoneAwareDateTimeField(required=True, source="creation_time")
666666
created_at_local = serializers.SerializerMethodField(
667-
help_text="The date and time when the record was created, displayed in the local timezone specified for this entry."
667+
help_text="The date and time when the record was created, displayed without timezone field."
668668
)
669669
sent_at = TimezoneAwareDateTimeField(required=True, source="phone_upload_time")
670670
published = serializers.SerializerMethodField()
@@ -675,7 +675,7 @@ class Meta:
675675
tags = TagListSerializerField(required=False, allow_empty=True)
676676

677677
def get_created_at_local(self, obj) -> datetime:
678-
return obj.creation_time_local
678+
return obj.creation_time_local.replace(tzinfo=None)
679679

680680
def get_published(self, obj) -> bool:
681681
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.latitude: 41.67419
4545
location.point.longitude: 2.79036
@@ -59,7 +59,7 @@ stages:
5959
short_id: !anystr
6060
user_uuid: "{app_user.pk}"
6161
created_at: '2024-01-01T00:00:00Z'
62-
created_at_local: '2024-01-01T01:00:00+01:00'
62+
created_at_local: '2024-01-01T01:00:00'
6363
sent_at: '2024-01-01T00:30:00Z'
6464
received_at: !re_fullmatch \d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{6}Z
6565
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]: "{test_jpg_image_path}"
4646
photos[1]: "{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.latitude: 41.67419
5151
location.point.longitude: 2.79036
@@ -63,7 +63,7 @@ stages:
6363
short_id: !anystr
6464
user_uuid: "{app_user.pk}"
6565
created_at: '2024-01-01T00:00:00Z'
66-
created_at_local: '2024-01-01T01:00:00+01:00'
66+
created_at_local: '2024-01-01T01:00:00'
6767
sent_at: '2024-01-01T00:30:00Z'
6868
received_at: !re_fullmatch \d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{6}Z
6969
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]: "{test_jpg_image_path}"
4646
photos[1]: "{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.latitude: 41.67419
5151
location.point.longitude: 2.79036
@@ -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/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)