mirror of
https://github.com/django/django.git
synced 2025-10-27 23:56:08 +00:00
Used bytes.hex() and bytes.fromhex() to simplify.
This commit is contained in:
committed by
Tim Graham
parent
3f237c1a5b
commit
93cdd07e8f
@@ -1,11 +1,9 @@
|
||||
import binascii
|
||||
import copy
|
||||
import datetime
|
||||
import re
|
||||
|
||||
from django.db.backends.base.schema import BaseDatabaseSchemaEditor
|
||||
from django.db.utils import DatabaseError
|
||||
from django.utils.encoding import force_text
|
||||
|
||||
|
||||
class DatabaseSchemaEditor(BaseDatabaseSchemaEditor):
|
||||
@@ -25,7 +23,7 @@ class DatabaseSchemaEditor(BaseDatabaseSchemaEditor):
|
||||
elif isinstance(value, str):
|
||||
return "'%s'" % value.replace("\'", "\'\'")
|
||||
elif isinstance(value, (bytes, bytearray, memoryview)):
|
||||
return "'%s'" % force_text(binascii.hexlify(value))
|
||||
return "'%s'" % value.hex()
|
||||
elif isinstance(value, bool):
|
||||
return "1" if value else "0"
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user