As mentioned in Marking models to create REST APIs, all the custom parameters for view needs to be mentioned in a ViewParams class and all such class needs to be in module view_params in the directory of the app. Let us create a new file in the same working directory called view_params.py and create a class as shown below:
Note that the dictionary returned by getParams() must contain an entry with key to_rest.constants.SERIALIZER_CLASS. Now, let us go back to models.py and see how to provide the custom serializer that we created.