class PostSerializer(serializers.ModelSerializer): user = serializers.PrimaryKeyRelatedField(queryset=User.objects.all()) class Meta: model = Post fields = ('id', 'user', 'comment')