-
Notifications
You must be signed in to change notification settings - Fork 296
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix PUT /api/v1/escalation_policies/<id> issue related to updating from_time and to_time #3581
Changes from all commits
0883381
9267eb3
7c54243
a9e95d2
12a6ce3
5f25fb7
5cdeb95
d27768c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
import time | ||
|
||
from django.core.exceptions import ObjectDoesNotExist | ||
from rest_framework import fields, serializers | ||
from rest_framework.exceptions import ValidationError | ||
|
@@ -102,25 +100,6 @@ def to_internal_value(self, data): | |
return queryset.filter(organization=request.user.organization, public_primary_key__in=data).distinct() | ||
|
||
|
||
class CustomTimeField(fields.TimeField): | ||
def to_representation(self, value): | ||
result = super().to_representation(value) | ||
if result[-1] != "Z": | ||
result += "Z" | ||
return result | ||
|
||
def to_internal_value(self, data): | ||
TIME_FORMAT_LEN = len("00:00:00Z") | ||
if len(data) == TIME_FORMAT_LEN: | ||
try: | ||
time.strptime(data, "%H:%M:%SZ") | ||
except ValueError: | ||
raise BadRequest(detail="Invalid time format, should be '00:00:00Z'") | ||
else: | ||
raise BadRequest(detail="Invalid time format, should be '00:00:00Z'") | ||
return data | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. returning a Additionally, we don't need to subclass |
||
|
||
class RouteIdField(fields.CharField): | ||
Comment on lines
-105
to
-123
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is only used by |
||
def to_internal_value(self, data): | ||
try: | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
main focus of PR