diff options
| author | Tom Christie | 2014-11-13 19:35:03 +0000 |
|---|---|---|
| committer | Tom Christie | 2014-11-13 19:35:03 +0000 |
| commit | fd97d9bff82b96b9362930686b9008ba78326115 (patch) | |
| tree | dd268812c3381d0f8fe8b1dedcc78f826f58b994 /rest_framework/relations.py | |
| parent | ea98de9b889173235a908ee2ce5a2aba5d8223c7 (diff) | |
| download | django-rest-framework-fd97d9bff82b96b9362930686b9008ba78326115.tar.bz2 | |
Use select inputs for relationships. Closes #2058.
Diffstat (limited to 'rest_framework/relations.py')
| -rw-r--r-- | rest_framework/relations.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/rest_framework/relations.py b/rest_framework/relations.py index 48ddf41e..6dc02a11 100644 --- a/rest_framework/relations.py +++ b/rest_framework/relations.py @@ -34,13 +34,13 @@ class RelatedField(Field): def __new__(cls, *args, **kwargs): # We override this method in order to automagically create - # `ManyRelation` classes instead when `many=True` is set. + # `ManyRelatedField` classes instead when `many=True` is set. if kwargs.pop('many', False): list_kwargs = {'child_relation': cls(*args, **kwargs)} for key in kwargs.keys(): if key in MANY_RELATION_KWARGS: list_kwargs[key] = kwargs[key] - return ManyRelation(**list_kwargs) + return ManyRelatedField(**list_kwargs) return super(RelatedField, cls).__new__(cls, *args, **kwargs) def run_validation(self, data=empty): @@ -286,12 +286,12 @@ class SlugRelatedField(RelatedField): return getattr(obj, self.slug_field) -class ManyRelation(Field): +class ManyRelatedField(Field): """ Relationships with `many=True` transparently get coerced into instead being - a ManyRelation with a child relationship. + a ManyRelatedField with a child relationship. - The `ManyRelation` class is responsible for handling iterating through + The `ManyRelatedField` class is responsible for handling iterating through the values and passing each one to the child relationship. You shouldn't need to be using this class directly yourself. @@ -302,7 +302,7 @@ class ManyRelation(Field): def __init__(self, child_relation=None, *args, **kwargs): self.child_relation = child_relation assert child_relation is not None, '`child_relation` is a required argument.' - super(ManyRelation, self).__init__(*args, **kwargs) + super(ManyRelatedField, self).__init__(*args, **kwargs) self.child_relation.bind(field_name='', parent=self) def get_value(self, dictionary): |
