diff options
Diffstat (limited to 'django/core/serializers/python.py')
| -rw-r--r-- | django/core/serializers/python.py | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/django/core/serializers/python.py b/django/core/serializers/python.py index 46ef9f0771..57edebbb70 100644 --- a/django/core/serializers/python.py +++ b/django/core/serializers/python.py @@ -7,6 +7,7 @@ other serializers. from django.apps import apps from django.core.serializers import base from django.db import DEFAULT_DB_ALIAS, models +from django.db.models import CompositePrimaryKey from django.utils.encoding import is_protected_type @@ -39,6 +40,8 @@ class Serializer(base.Serializer): return data def _value_from_field(self, obj, field): + if isinstance(field, CompositePrimaryKey): + return [self._value_from_field(obj, f) for f in 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 |
