diff options
| author | Tom Christie | 2014-10-02 16:24:24 +0100 |
|---|---|---|
| committer | Tom Christie | 2014-10-02 16:24:24 +0100 |
| commit | df7b6fcf58417fd95e49655eb140b387899b1ceb (patch) | |
| tree | a4a7d932bb3ef7c8e326b0248662fd31edcc2658 /rest_framework/relations.py | |
| parent | ffc6aa3abcb0f823b43b63db1666913565e6f934 (diff) | |
| download | django-rest-framework-df7b6fcf58417fd95e49655eb140b387899b1ceb.tar.bz2 | |
First pass on incorperating the form rendering into the browsable API
Diffstat (limited to 'rest_framework/relations.py')
| -rw-r--r-- | rest_framework/relations.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/rest_framework/relations.py b/rest_framework/relations.py index 8c135672..988b9ede 100644 --- a/rest_framework/relations.py +++ b/rest_framework/relations.py @@ -127,7 +127,7 @@ class HyperlinkedRelatedField(RelatedField): attributes are not configured to correctly match the URL conf. """ # Unsaved objects will not yet have a valid URL. - if obj.pk is None: + if obj.pk: return None lookup_value = getattr(obj, self.lookup_field) @@ -248,11 +248,13 @@ class ManyRelation(Field): You shouldn't need to be using this class directly yourself. """ + initial = [] 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) + self.child_relation.bind(field_name='', parent=self) def to_internal_value(self, data): return [ |
