diff options
| author | Tom Christie | 2014-12-11 09:42:21 +0000 |
|---|---|---|
| committer | Tom Christie | 2014-12-11 09:42:21 +0000 |
| commit | f21bf4d6dd7ed90b59945704f818732135ac86c4 (patch) | |
| tree | 2be86beab02b243036cce77c94d4256182852057 /tutorial/5-relationships-and-hyperlinked-apis/index.html | |
| parent | 5816c561b23c1c3403cb04bd69356ace1102e1e7 (diff) | |
| download | django-rest-framework-f21bf4d6dd7ed90b59945704f818732135ac86c4.tar.bz2 | |
Update documentation
Diffstat (limited to 'tutorial/5-relationships-and-hyperlinked-apis/index.html')
| -rw-r--r-- | tutorial/5-relationships-and-hyperlinked-apis/index.html | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/tutorial/5-relationships-and-hyperlinked-apis/index.html b/tutorial/5-relationships-and-hyperlinked-apis/index.html index 52ecf307..5742c884 100644 --- a/tutorial/5-relationships-and-hyperlinked-apis/index.html +++ b/tutorial/5-relationships-and-hyperlinked-apis/index.html @@ -447,7 +447,7 @@ We'll add a url pattern for our new API root in <code>snippets/urls.py</code>:</ </ul> <p>We can easily re-write our existing serializers to use hyperlinking. In your <code>snippets/serializers.py</code> add:</p> <pre><code>class SnippetSerializer(serializers.HyperlinkedModelSerializer): - owner = serializers.Field(source='owner.username') + owner = serializers.ReadOnlyField(source='owner.username') highlight = serializers.HyperlinkedIdentityField(view_name='snippet-highlight', format='html') class Meta: @@ -457,7 +457,7 @@ We'll add a url pattern for our new API root in <code>snippets/urls.py</code>:</ class UserSerializer(serializers.HyperlinkedModelSerializer): - snippets = serializers.HyperlinkedRelatedField(many=True, view_name='snippet-detail', read_only=True) + snippets = serializers.HyperlinkedRelatedField(many=True, view_name='snippet-detail') class Meta: model = User @@ -537,7 +537,6 @@ urlpatterns += [ <script src="../../js/jquery-1.8.1-min.js"></script> <script src="../../js/prettify-1.0.js"></script> <script src="../../js/bootstrap-2.1.1-min.js"></script> - <script src="../../js/theme.js"></script> <script> //$('.side-nav').scrollspy() |
