though it looks that it suggested to 
<https://github.com/django/django/blob/2.1.5/django/core/serializers/json.py#L101>
.
In source for DjangoJSONEncoder we see

class DjangoJSONEncoder(json.JSONEncoder):
    ...

    elif isinstance(o, (decimal.Decimal, uuid.UUID, Promise)):
        return str(o)

    ...

and it should handle only types that are passed through _value_from_field 
<https://github.com/django/django/blob/2.1.5/django/core/serializers/python.py#L42-L47>
:

def _value_from_field(self, obj, field):
    value = field.value_from_object(obj)
    # Protected types (i.e., primitives like None, numbers, dates,
    # and Decimals) are passed through as is. All other values are
    # converted to string first.
    return value if is_protected_type(value) else field.value_to_string(obj)


But in _PROTECTED_TYPES we don't see uuid.UUID included 
<https://github.com/django/django/blob/2.1.5/django/utils/encoding.py#L37-L48>, 
so I can't hook and override UUID serialization.

Am I missing something or is it a bug?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/b2a4219e-8706-46d7-8eca-ddb43ec7e559%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to