mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-01-24 00:04:16 +03:00
Simplify inherited child check to not use isinstance
This commit is contained in:
parent
e7e470739f
commit
bdcecf48e3
|
@ -458,7 +458,7 @@ class ModelSerializer(Serializer):
|
||||||
pk_field = opts.pk
|
pk_field = opts.pk
|
||||||
|
|
||||||
# If model is a child via multitable inheritance, use parent's pk
|
# If model is a child via multitable inheritance, use parent's pk
|
||||||
while isinstance(pk_field, models.OneToOneField) and pk_field.rel.parent_link:
|
while pk_field.rel and pk_field.rel.parent_link:
|
||||||
pk_field = pk_field.rel.to._meta.pk
|
pk_field = pk_field.rel.to._meta.pk
|
||||||
|
|
||||||
fields = [pk_field]
|
fields = [pk_field]
|
||||||
|
|
Loading…
Reference in New Issue
Block a user