mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-08-07 13:54:47 +03:00
Merge 5b5a95a413
into 7ab4a587d9
This commit is contained in:
commit
b6daf5112c
|
@ -7,7 +7,7 @@ from django.core.exceptions import ImproperlyConfigured, ObjectDoesNotExist
|
|||
from django.core.urlresolvers import (
|
||||
NoReverseMatch, Resolver404, get_script_prefix, resolve
|
||||
)
|
||||
from django.db.models import Manager
|
||||
from django.db.models import Manager, Model
|
||||
from django.db.models.query import QuerySet
|
||||
from django.utils import six
|
||||
from django.utils.encoding import python_2_unicode_compatible, smart_text
|
||||
|
@ -226,6 +226,8 @@ class PrimaryKeyRelatedField(RelatedField):
|
|||
return True
|
||||
|
||||
def to_internal_value(self, data):
|
||||
if isinstance(data, Model):
|
||||
return data
|
||||
if self.pk_field is not None:
|
||||
data = self.pk_field.to_internal_value(data)
|
||||
try:
|
||||
|
|
Loading…
Reference in New Issue
Block a user