mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-12-02 22:44:08 +03:00
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.
This commit is contained in:
parent
166025c0fc
commit
a33aa23484
|
@ -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')
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user