mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-02-02 20:54:42 +03:00
Add 'to_many' flag in get_related_field
This commit is contained in:
parent
9bbc1cc403
commit
a3ab66eca4
|
@ -304,6 +304,13 @@ class ModelSerializer(Serializer):
|
||||||
"""
|
"""
|
||||||
Return all the fields that should be serialized for the model.
|
Return all the fields that should be serialized for the model.
|
||||||
"""
|
"""
|
||||||
|
# TODO: Modfiy this so that it's called on init, and drop
|
||||||
|
# serialize/obj/data arguments.
|
||||||
|
#
|
||||||
|
# We *could* provide a hook for dynamic fields, but
|
||||||
|
# it'd be nice if the default was to generate fields statically
|
||||||
|
# at the point of __init__
|
||||||
|
|
||||||
cls = self.opts.model
|
cls = self.opts.model
|
||||||
opts = get_concrete_model(cls)._meta
|
opts = get_concrete_model(cls)._meta
|
||||||
pk_field = opts.pk
|
pk_field = opts.pk
|
||||||
|
|
Loading…
Reference in New Issue
Block a user