<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>django.contrib.webdesign — Django 1.4.5 documentation</title> <link rel="stylesheet" href="../../_static/default.css" type="text/css" /> <link rel="stylesheet" href="../../_static/pygments.css" type="text/css" /> <script type="text/javascript"> var DOCUMENTATION_OPTIONS = { URL_ROOT: '../../', VERSION: '1.4.5', COLLAPSE_INDEX: false, FILE_SUFFIX: '.html', HAS_SOURCE: true }; </script> <script type="text/javascript" src="../../_static/jquery.js"></script> <script type="text/javascript" src="../../_static/underscore.js"></script> <script type="text/javascript" src="../../_static/doctools.js"></script> <link rel="top" title="Django 1.4.5 documentation" href="../../index.html" /> <link rel="up" title="contrib packages" href="index.html" /> <link rel="next" title="Databases" href="../databases.html" /> <link rel="prev" title="The syndication feed framework" href="syndication.html" /> <script type="text/javascript" src="../../templatebuiltins.js"></script> <script type="text/javascript"> (function($) { if (!django_template_builtins) { // templatebuiltins.js missing, do nothing. return; } $(document).ready(function() { // Hyperlink Django template tags and filters var base = "../templates/builtins.html"; if (base == "#") { // Special case for builtins.html itself base = ""; } // Tags are keywords, class '.k' $("div.highlight\\-html\\+django span.k").each(function(i, elem) { var tagname = $(elem).text(); if ($.inArray(tagname, django_template_builtins.ttags) != -1) { var fragment = tagname.replace(/_/, '-'); $(elem).html("<a href='" + base + "#" + fragment + "'>" + tagname + "</a>"); } }); // Filters are functions, class '.nf' $("div.highlight\\-html\\+django span.nf").each(function(i, elem) { var filtername = $(elem).text(); if ($.inArray(filtername, django_template_builtins.tfilters) != -1) { var fragment = filtername.replace(/_/, '-'); $(elem).html("<a href='" + base + "#" + fragment + "'>" + filtername + "</a>"); } }); }); })(jQuery); </script> </head> <body> <div class="document"> <div id="custom-doc" class="yui-t6"> <div id="hd"> <h1><a href="../../index.html">Django 1.4.5 documentation</a></h1> <div id="global-nav"> <a title="Home page" href="../../index.html">Home</a> | <a title="Table of contents" href="../../contents.html">Table of contents</a> | <a title="Global index" href="../../genindex.html">Index</a> | <a title="Module index" href="../../py-modindex.html">Modules</a> </div> <div class="nav"> « <a href="syndication.html" title="The syndication feed framework">previous</a> | <a href="../index.html" title="API Reference" accesskey="U">up</a> | <a href="../databases.html" title="Databases">next</a> »</div> </div> <div id="bd"> <div id="yui-main"> <div class="yui-b"> <div class="yui-g" id="ref-contrib-webdesign"> <div class="section" id="s-module-django.contrib.webdesign"> <span id="s-django-contrib-webdesign"></span><span id="module-django.contrib.webdesign"></span><span id="django-contrib-webdesign"></span><h1>django.contrib.webdesign<a class="headerlink" href="#module-django.contrib.webdesign" title="Permalink to this headline">¶</a></h1> <p>The <tt class="docutils literal"><span class="pre">django.contrib.webdesign</span></tt> package, part of the <a class="reference internal" href="index.html"><em>“django.contrib” add-ons</em></a>, provides various Django helpers that are particularly useful to Web <em>designers</em> (as opposed to developers).</p> <p>At present, the package contains only a single template tag. If you have ideas for Web-designer-friendly functionality in Django, please <a class="reference internal" href="../../internals/contributing/index.html"><em>suggest them</em></a>.</p> <div class="section" id="s-template-tags"> <span id="template-tags"></span><h2>Template tags<a class="headerlink" href="#template-tags" title="Permalink to this headline">¶</a></h2> <p>To use these template tags, add <tt class="docutils literal"><span class="pre">'django.contrib.webdesign'</span></tt> to your <a class="reference internal" href="../settings.html#std:setting-INSTALLED_APPS"><tt class="xref std std-setting docutils literal"><span class="pre">INSTALLED_APPS</span></tt></a> setting. Once you’ve done that, use <tt class="docutils literal"><span class="pre">{%</span> <span class="pre">load</span> <span class="pre">webdesign</span> <span class="pre">%}</span></tt> in a template to give your template access to the tags.</p> </div> <div class="section" id="s-lorem"> <span id="lorem"></span><h2>lorem<a class="headerlink" href="#lorem" title="Permalink to this headline">¶</a></h2> <p>Displays random “lorem ipsum” Latin text. This is useful for providing sample data in templates.</p> <p>Usage:</p> <div class="highlight-python"><pre>{% lorem [count] [method] [random] %}</pre> </div> <p>The <tt class="docutils literal"><span class="pre">{%</span> <span class="pre">lorem</span> <span class="pre">%}</span></tt> tag can be used with zero, one, two or three arguments. The arguments are:</p> <table class="docutils"> <colgroup> <col width="15%" /> <col width="85%" /> </colgroup> <thead valign="bottom"> <tr class="row-odd"><th class="head">Argument</th> <th class="head">Description</th> </tr> </thead> <tbody valign="top"> <tr class="row-even"><td><tt class="docutils literal"><span class="pre">count</span></tt></td> <td>A number (or variable) containing the number of paragraphs or words to generate (default is 1).</td> </tr> <tr class="row-odd"><td><tt class="docutils literal"><span class="pre">method</span></tt></td> <td>Either <tt class="docutils literal"><span class="pre">w</span></tt> for words, <tt class="docutils literal"><span class="pre">p</span></tt> for HTML paragraphs or <tt class="docutils literal"><span class="pre">b</span></tt> for plain-text paragraph blocks (default is <tt class="docutils literal"><span class="pre">b</span></tt>).</td> </tr> <tr class="row-even"><td><tt class="docutils literal"><span class="pre">random</span></tt></td> <td>The word <tt class="docutils literal"><span class="pre">random</span></tt>, which if given, does not use the common paragraph (“Lorem ipsum dolor sit amet...”) when generating text.</td> </tr> </tbody> </table> <p>Examples:</p> <ul class="simple"> <li><tt class="docutils literal"><span class="pre">{%</span> <span class="pre">lorem</span> <span class="pre">%}</span></tt> will output the common “lorem ipsum” paragraph.</li> <li><tt class="docutils literal"><span class="pre">{%</span> <span class="pre">lorem</span> <span class="pre">3</span> <span class="pre">p</span> <span class="pre">%}</span></tt> will output the common “lorem ipsum” paragraph and two random paragraphs each wrapped in HTML <tt class="docutils literal"><span class="pre"><p></span></tt> tags.</li> <li><tt class="docutils literal"><span class="pre">{%</span> <span class="pre">lorem</span> <span class="pre">2</span> <span class="pre">w</span> <span class="pre">random</span> <span class="pre">%}</span></tt> will output two random Latin words.</li> </ul> </div> </div> </div> </div> </div> <div class="yui-b" id="sidebar"> <div class="sphinxsidebar"> <div class="sphinxsidebarwrapper"> <h3><a href="../../contents.html">Table Of Contents</a></h3> <ul> <li><a class="reference internal" href="#">django.contrib.webdesign</a><ul> <li><a class="reference internal" href="#template-tags">Template tags</a></li> <li><a class="reference internal" href="#lorem">lorem</a></li> </ul> </li> </ul> <h3>Browse</h3> <ul> <li>Prev: <a href="syndication.html">The syndication feed framework</a></li> <li>Next: <a href="../databases.html">Databases</a></li> </ul> <h3>You are here:</h3> <ul> <li> <a href="../../index.html">Django 1.4.5 documentation</a> <ul><li><a href="../index.html">API Reference</a> <ul><li><a href="index.html"><tt class="docutils literal docutils literal docutils literal docutils literal docutils literal docutils literal docutils literal docutils literal docutils literal docutils literal docutils literal docutils literal docutils literal docutils literal docutils literal docutils literal docutils literal docutils literal docutils literal docutils literal docutils literal docutils literal docutils literal docutils literal docutils literal docutils literal docutils literal docutils literal docutils literal docutils literal docutils literal docutils literal docutils literal docutils literal docutils literal docutils literal docutils literal docutils literal docutils literal docutils literal docutils literal docutils literal docutils literal docutils literal docutils literal docutils literal docutils literal docutils literal docutils literal docutils literal docutils literal docutils literal"><span class="pre">contrib</span></tt> packages</a> <ul><li>django.contrib.webdesign</li></ul> </li></ul></li></ul> </li> </ul> <h3>This Page</h3> <ul class="this-page-menu"> <li><a href="../../_sources/ref/contrib/webdesign.txt" rel="nofollow">Show Source</a></li> </ul> <div id="searchbox" style="display: none"> <h3>Quick search</h3> <form class="search" action="../../search.html" method="get"> <input type="text" name="q" /> <input type="submit" value="Go" /> <input type="hidden" name="check_keywords" value="yes" /> <input type="hidden" name="area" value="default" /> </form> <p class="searchtip" style="font-size: 90%"> Enter search terms or a module, class or function name. </p> </div> <script type="text/javascript">$('#searchbox').show(0);</script> </div> </div> <h3>Last update:</h3> <p class="topless">Feb 21, 2013</p> </div> </div> <div id="ft"> <div class="nav"> « <a href="syndication.html" title="The syndication feed framework">previous</a> | <a href="../index.html" title="API Reference" accesskey="U">up</a> | <a href="../databases.html" title="Databases">next</a> »</div> </div> </div> <div class="clearer"></div> </div> </body> </html>