Skip to content

Commit

Permalink
#10729: Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremystretch committed Mar 21, 2023
1 parent 402d5d9 commit 1e493f6
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions netbox/extras/models/customfields.py
Original file line number Diff line number Diff line change
Expand Up @@ -313,9 +313,10 @@ def serialize(self, value):
"""
if value is None:
return value
if self.type in (CustomFieldTypeChoices.TYPE_DATE, CustomFieldTypeChoices.TYPE_DATETIME):
if type(value) in (date, datetime):
return value.isoformat()
if self.type == CustomFieldTypeChoices.TYPE_DATE and type(value) is date:
return value.isoformat()
if self.type == CustomFieldTypeChoices.TYPE_DATETIME and type(value) is datetime:
return value.isoformat()
if self.type == CustomFieldTypeChoices.TYPE_OBJECT:
return value.pk
if self.type == CustomFieldTypeChoices.TYPE_MULTIOBJECT:
Expand Down

0 comments on commit 1e493f6

Please sign in to comment.