Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
django-rest-framework
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
django-rest-framework
Commits
fd57978c
Commit
fd57978c
authored
Feb 08, 2013
by
Tom Christie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add missing `model =` to serializer classes in docs
parent
15c8fd96
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
0 deletions
+6
-0
docs/api-guide/relations.md
+6
-0
No files found.
docs/api-guide/relations.md
View file @
fd57978c
...
@@ -46,6 +46,7 @@ For example, the following serializer.
...
@@ -46,6 +46,7 @@ For example, the following serializer.
tracks = RelatedField(many=True)
tracks = RelatedField(many=True)
class Meta:
class Meta:
model = Album
fields = ('album_name', 'artist', 'tracks')
fields = ('album_name', 'artist', 'tracks')
Would serialize to the following representation.
Would serialize to the following representation.
...
@@ -73,6 +74,7 @@ For example, the following serializer:
...
@@ -73,6 +74,7 @@ For example, the following serializer:
tracks = PrimaryKeyRelatedField(many=True, read_only=True)
tracks = PrimaryKeyRelatedField(many=True, read_only=True)
class Meta:
class Meta:
model = Album
fields = ('album_name', 'artist', 'tracks')
fields = ('album_name', 'artist', 'tracks')
Would serialize to a representation like this:
Would serialize to a representation like this:
...
@@ -106,6 +108,7 @@ For example, the following serializer:
...
@@ -106,6 +108,7 @@ For example, the following serializer:
view_name='track-detail')
view_name='track-detail')
class Meta:
class Meta:
model = Album
fields = ('album_name', 'artist', 'tracks')
fields = ('album_name', 'artist', 'tracks')
Would serialize to a representation like this:
Would serialize to a representation like this:
...
@@ -143,6 +146,7 @@ For example, the following serializer:
...
@@ -143,6 +146,7 @@ For example, the following serializer:
tracks = SlugRelatedField(many=True, read_only=True, slug_field='title')
tracks = SlugRelatedField(many=True, read_only=True, slug_field='title')
class Meta:
class Meta:
model = Album
fields = ('album_name', 'artist', 'tracks')
fields = ('album_name', 'artist', 'tracks')
Would serialize to a representation like this:
Would serialize to a representation like this:
...
@@ -176,6 +180,7 @@ This field can be applied as an identity relationship, such as the `'url'` field
...
@@ -176,6 +180,7 @@ This field can be applied as an identity relationship, such as the `'url'` field
track_listing = HyperLinkedIdentityField(view_name='track-list')
track_listing = HyperLinkedIdentityField(view_name='track-list')
class Meta:
class Meta:
model = Album
fields = ('album_name', 'artist', 'track_listing')
fields = ('album_name', 'artist', 'track_listing')
Would serialize to a representation like this:
Would serialize to a representation like this:
...
@@ -208,6 +213,7 @@ Nested relationships can be expressed by using serializers as fields. For examp
...
@@ -208,6 +213,7 @@ Nested relationships can be expressed by using serializers as fields. For examp
tracks = TrackSerializer(many=True)
tracks = TrackSerializer(many=True)
class Meta:
class Meta:
model = Album
fields = ('album_name', 'artist', 'tracks')
fields = ('album_name', 'artist', 'tracks')
Note that nested relationships are currently read-only. For read-write relationships, you should use a flat relational style.
Note that nested relationships are currently read-only. For read-write relationships, you should use a flat relational style.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment