This probably comes from the Django template and the locals trick. The idea is to populate a number of variables inside a function, and use locals()
to pass them on to a template. It saves the effort of creating a new dictionary with all those variables.
Specifically, your code creates a dictionary of all the local variables and removes self
(the class object parameter) and info
(the variable that was just created). All other local variables are returned.
You could then JSON serialize the data, as long as the data can be serialized. DateTime variables must be converted to a string first, for example.