Monthly Archives: March 2014

Django to return formatted Json

To control the json data that gets returned to the view.

Define a method in model that looks something like that:

The method as_queuelist_report in model controls what the json looks like.

In your view.py you will have a method that looks like:

I find this to be a neat trick to control how a json looks like when you want to control what gets returned to the front end.