Package: django-updateable
django-updateabledjango-updateable adds template tags to automatically update parts of pages via AJAX.InstallYou can use pip to install:pip install django-updateableConfigureAfter installing django-updateable you must change a few settings in your settings.pyAddupdateableto INSTALLED_APPSAddupdateable.middleware.UpdateableMiddlewareto MIDDLEWARE_CLASSESBe sure to use thedjango.core.context_processors.requestin your TEMPLATE_CONTEXT_PROCESSORSUsageAdd updateable.js to the pages where you use updateable, e.g.<scriptsrc="{%static "updateable.js"%}"></script>. Load the tags in your
template,{% load updateable %}. Wrap the parts of you template you would
like to update automatically in{% updateable %}and{% endupdateable %}tags.Example template{% load staticfiles updateable %}

<!doctype html>
<html>
  <head>
    <title>example</title>
    <script src='{% static 'updateable.js' %}'></script>
  </head>
  <body>
  <h1>Static header</h1>
  {% updateable %}
    The time is {% now 'H:i:s' %}
  {% endupdateable %}
  </body>
</html>The time will be updated with 3 second intervals.Supported platformsdjango-updateable has been tested with Django 1.3, 1.4 and 1.5 on Python 2.7
and with Django 1.5 on Python 2.6.It has been tested on the latest version of Chrome (26) and Firefox (20). It
works with IE8 and up. If you need support for earlier versions of Internet
Explorer you can usethis JavaScript filewhich depends on jQuery.Implementation detailsThe content in a{% updateable %}template tag is wrapped in a<div>element that contains data attributes with a unique ID and an MD5 hash of the
content. Every AJAX request contains the IDs and hashes of the updateable
blocks on the page along with a GET variable that triggers the
UpdateableMiddleware to return only the parts of the page that have been
updated (the MD5 sum is used to decide which parts contain content that has
changed).A new dictionary object is created on the request object (request._updateable)
that contains data for the UpdateableMiddleware and the UpdateableNode (in the
template). The name of this object can be configured in the settings.Advanced settingsOptional settings in settings.py:UPDATEABLE_REQUEST_OBJECT
The name of the dictionary object that is created on the request object.
Defaults to'_updateable'UPDATEABLE_GET_VARIABLE
Configures the name of the GET variable that triggers UpdateableMiddleware
to intercept the response and return only the updated parts of the page.
See getVariable in the JavaScript settings.
Defaults to'update'Optional template tag setting:{% updateable [tagname] %}
The given tagname is used for the enclosing element around the contents
inside the updateable template tag.
Defaults todivOptional JavaScript settings:getVariable
The name of the GET variable that triggers the UpdateableMiddleware.
See UPDATEABLE_GET_VARIABLES
Defaults to'update'timeout
Milliseconds between AJAX calls.
Defaults to3000callback
A function that is called for each DOM object that is replaced. The context
of the function is the newly added DOM object.
Defaults to an empty functionThe JavaScript settings are read from a global object (on the window object)
called updateableSettings. Example:<head>
  <script>
    updateableSettings = {
      timeout: 5000,
      callback: function() {
        console.log(this);
    };
  </script>
  <script src='{% static 'updateable.js' %}'></script>
</head>Usage with jQuery Mobiledjango-updateable began life in a project that usedjQuery Mobile. When the
content is updated it is necessary to calltrigger('create')on the new
DOM element, so the following updateableSettings can be useful in those
circumstances:updateableSettings = {
  callback: function() {
    $(this).trigger('create');
  }
}Release history0.2.1Bugfix: IDs of updateable segments that started with numbers caused a bug in
the Javascript. Many thanks toedtanous!0.2Bugfixes, and jQuery is no longer a dependency (except for old browsers).0.1Initial release.