AJAX and other Data FormatsΒΆ

Molly’s approach to views lends itself to a large amount of flexibility. One such flexibility is the ability to vary the format of the rendered view based on the Accept headers of the client, or a manual override of the data format based on an additional GET parameter: format.

To stop this functionality on a particular view (e.g., if the context contains data that should not be exposed), you can set exposes_user_data to True in the context.

The data formats supported are:

  • XML
  • JSON/JSONP
  • YAML

And in each of these, the is presented as it is in the context.

An additional format, ‘fragment’ is also available. This provides the body and title HTML of a template encoded using JSON. It’s used for the AJAX functionality introduced in Molly 1.1.

Project Versions

Previous topic

Writing an application

Next topic

Application media

This Page