django-delayedblocks

Django Delayed Blocks
Download

django-delayedblocks Ranking & Summary

Advertisement

  • Rating:
  • License:
  • BSD License
  • Price:
  • FREE
  • Publisher Name:
  • Jonas Obrist
  • Publisher web site:
  • http://github.com/ojii/

django-delayedblocks Tags


django-delayedblocks Description

Django Delayed Blocks django-delayedblocks was created because the frontend developers working with the django-cms were not happy with the media framework, especially the javascript part. They wanted the javascript to be at the bottom and to be able to define it in the templates, rather than the python files. As a result, I wrote this small application.Basically it allows you to define blocks which will be rendered at a later point in the template. It also removes duplicates, which is very useful for cms plugins that require javascript libraries.Usage:This application is a template tag library only, load it in your templates using `{% load delayedblocks %}`.You can delay blocks using the `delayedblock` block tag: {% delayedblock %} code to be delayed here {% enddelayedblock %}After all your delayed blocks, use `render_delayed_blocks` to actually render the contents. Note that any delayed block after that call will *not* be rendered!Example:An example template would be: {% load delayedblocks %} Lorem Ipsum {% delayedblock %} < script type="text/javascript" src="jquery.js" >< /script > {% enddelayedblock %} Hello World {% delayedblock %} < script type="text/javascript" src="jquery2.js" >< /script > {% enddelayedblock %} Python Rocks {% delayedblock %} < script type="text/javascript" src="jquery.js" >< /script > {% enddelayedblock %} Django FTW {% render_delayed_blocks %}Would render (roughly, whitespaces are not correct) as: Lorem Ipsum Hello World Python Rocks Django FTW < script type="text/javascript" src="jquery.js" >< /script > < script type="text/javascript" src="jquery2.js" >< /script > Requirements: · Python · Django


django-delayedblocks Related Software