From a33aa23484241775cb49c61c0282c3b3f537eff1 Mon Sep 17 00:00:00 2001 From: Pavel Savchenko Date: Tue, 30 Oct 2012 22:00:01 +0200 Subject: [PATCH] using 'pk' in fields throws KeyError I've been following the tutorial step-by-step (using sqlite and the same project structure, etc). I cannot for the life of me make 'pk' be accepted as a valid field for Meta.fields of ModelSerializer... 'id' on the other hand seems to work very well. --- docs/tutorial/1-serialization.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/tutorial/1-serialization.md b/docs/tutorial/1-serialization.md index 5cf16a67f..316a3c255 100644 --- a/docs/tutorial/1-serialization.md +++ b/docs/tutorial/1-serialization.md @@ -201,7 +201,7 @@ Open the file `snippets/serializers.py` again, and edit the `SnippetSerializer` class SnippetSerializer(serializers.ModelSerializer): class Meta: model = Snippet - fields = ('pk', 'title', 'code', 'linenos', 'language', 'style') + fields = ('id', 'title', 'code', 'linenos', 'language', 'style')