From 84f3b33d4f37edfaf5294eaab3f4ff0fdcacc86e Mon Sep 17 00:00:00 2001 From: Augustin Date: Wed, 25 May 2022 15:35:51 +0800 Subject: [PATCH] doc: missing self on CustomSerializer serialize Change GET_SINGLE to GET_RESOURCE in the doc. --- docs/customizing.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/customizing.rst b/docs/customizing.rst index 109db878..e2c449ea 100644 --- a/docs/customizing.rst +++ b/docs/customizing.rst @@ -155,7 +155,7 @@ Define your serialization functions like this:: def relationship_columns(self): return set(self.relationships) - def serialize(instance, only=None): + def serialize(self, instance, only=None): return {'id': instance.id, 'type': 'custom', 'attributes': {}} ``instance`` is an instance of a SQLAlchemy model and the ``only`` argument is @@ -467,7 +467,7 @@ authentication function can be implemented like this:: # instance of the model. if not is_authorized_to_modify(current_user, instance_id): raise ProcessingException(detail='Not Authorized', status=401) - manager.create_api(Person, preprocessors=dict(GET_SINGLE=[check_auth])) + manager.create_api(Person, preprocessors=dict(GET_RESOURCE=[check_auth])) The :exc:`ProcessingException` allows you to specify as keyword arguments to the constructor the elements of the JSON API `error object`_. If no arguments