Django Rest Framework: Adding a custom field to a paginated ViewSet

Viewed 1415

I have a paginated result set so the response comes back like this:

{
"count": 944,
"next": "http://api.visitorlando.teeny/consumer/listings/?page=3",
"previous": "http://api.visitorlando.teeny/consumer/listings/",
"results": [
 {...}]
}

I need to add another custom field to the Response like this:

{
"count": 944,
"custom_field": "test",
"next": "http://api.visitorlando.teeny/consumer/listings/?page=3",
"previous": "http://api.visitorlando.teeny/consumer/listings/",
"results": [
 {...}]
}

and I am inside a ViewSet. How am I able to do this?

1 Answers
Related