Skip to content

Commit 5334f33

Browse files
committed
fix HexIntegerField.get_prep_value when value is already a string
value may already be an integer so trying to create a base 16 int from it fails
1 parent ff23c6e commit 5334f33

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

push_notifications/fields.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@ def db_type(self, connection):
5353
def get_prep_value(self, value):
5454
if value is None or value == "":
5555
return None
56-
value = int(value, 16)
56+
if isinstance(value, six.string_types):
57+
value = int(value, 16)
5758
# on postgres only, interpret as signed
5859
if connection.settings_dict["ENGINE"] in postgres_engines:
5960
value = struct.unpack("q", struct.pack("Q", value))[0]

0 commit comments

Comments
 (0)