Commit 455a8ced by Tom Christie

Tweaks

parent 9746abdf
...@@ -239,7 +239,7 @@ Then an example output format for a Bookmark instance would be: ...@@ -239,7 +239,7 @@ Then an example output format for a Bookmark instance would be:
`PrimaryKeyRelatedField` and `ManyPrimaryKeyRelatedField` will represent the target of the relationship using it's primary key. `PrimaryKeyRelatedField` and `ManyPrimaryKeyRelatedField` will represent the target of the relationship using it's primary key.
Be default these fields read-write, although you can change this behaviour using the `read_only` flag. By default these fields are read-write, although you can change this behaviour using the `read_only` flag.
**Arguments**: **Arguments**:
...@@ -249,18 +249,18 @@ Be default these fields read-write, although you can change this behaviour using ...@@ -249,18 +249,18 @@ Be default these fields read-write, although you can change this behaviour using
`SlugRelatedField` and `ManySlugRelatedField` will represent the target of the relationship using a unique slug. `SlugRelatedField` and `ManySlugRelatedField` will represent the target of the relationship using a unique slug.
Be default these fields read-write, although you can change this behaviour using the `read_only` flag. By default these fields read-write, although you can change this behaviour using the `read_only` flag.
**Arguments**: **Arguments**:
* `slug_field` - The field on the target that should used as the representation. This should be a field that uniquely identifies any given instance. For example, `username`. * `slug_field` - The field on the target that should be used to represent it. This should be a field that uniquely identifies any given instance. For example, `username`.
* `queryset` - By default `ModelSerializer` classes will use the default queryset for the relationship. `Serializer` classes must either set a queryset explicitly, or set `read_only=True`. * `queryset` - By default `ModelSerializer` classes will use the default queryset for the relationship. `Serializer` classes must either set a queryset explicitly, or set `read_only=True`.
## HyperlinkedRelatedField / ManyHyperlinkedRelatedField ## HyperlinkedRelatedField / ManyHyperlinkedRelatedField
`HyperlinkedRelatedField` and `ManyHyperlinkedRelatedField` will represent the target of the relationship using a hyperlink. `HyperlinkedRelatedField` and `ManyHyperlinkedRelatedField` will represent the target of the relationship using a hyperlink.
Be default, `HyperlinkedRelatedField` is read-write, although you can change this behaviour using the `read_only` flag. By default, `HyperlinkedRelatedField` is read-write, although you can change this behaviour using the `read_only` flag.
**Arguments**: **Arguments**:
......
...@@ -184,7 +184,7 @@ class TestCreateWithForeignKeys(TestCase): ...@@ -184,7 +184,7 @@ class TestCreateWithForeignKeys(TestCase):
request = factory.post('/comments/', data=data) request = factory.post('/comments/', data=data)
response = self.create_view(request).render() response = self.create_view(request).render()
self.assertEqual(response.status_code, 201) self.assertEqual(response.status_code, status.HTTP_201_CREATED)
self.assertEqual(self.post.blogpostcomment_set.count(), 1) self.assertEqual(self.post.blogpostcomment_set.count(), 1)
self.assertEqual(self.post.blogpostcomment_set.all()[0].text, 'A test comment') self.assertEqual(self.post.blogpostcomment_set.all()[0].text, 'A test comment')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment