Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

252 lines (223 sloc) 13.309 kB
<!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>Models &mdash; Django Categories v1.0b2 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.0b2',
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 Categories v1.0b2 documentation" href="../index.html" />
<link rel="up" title="Reference" href="index.html" />
<link rel="next" title="Settings" href="settings.html" />
<link rel="prev" title="Management Commands" href="management_commands.html" />
</head>
<body>
<div id="docstitle">
<p>Django Categories v1.0b2 documentation</p>
</div>
<div id="header">
<div id="title"><h1>Models</h1></div>
<ul id="headerButtons">
<li id="toc_button"><div class="headerButton"><a href="#">Table of Contents</a></div></li>
<li id="page_buttons">
<div class="headerButton"><a href="../genindex.html" title="General Index" accesskey="I">index</a></div>
<div class="headerButton"><a href="settings.html" title="Settings" accesskey="N">next</a></div>
<div class="headerButton"><a href="management_commands.html" title="Management Commands" accesskey="P">previous</a></div>
</li>
</ul>
</div>
<div id="sphinxsidebar">
<div class="sphinxsidebarwrapper">
<ul><li class="toctree-l1"><a href="../index.html">Main Page</a></li></ul>
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="../installation.html">Installation</a></li>
<li class="toctree-l1"><a class="reference internal" href="../getting_started.html">Getting Started</a></li>
<li class="toctree-l1"><a class="reference internal" href="../usage.html">Using categories in templates</a></li>
<li class="toctree-l1"><a class="reference internal" href="../registering_models.html">Registering Models</a></li>
<li class="toctree-l1"><a class="reference internal" href="../adding_the_fields.html">Adding the fields to the database</a></li>
<li class="toctree-l1"><a class="reference internal" href="../custom_categories.html">Creating Custom Categories</a></li>
<li class="toctree-l1 current"><a class="reference internal" href="index.html">Reference</a><ul class="current">
<li class="toctree-l2"><a class="reference internal" href="management_commands.html">Management Commands</a></li>
<li class="toctree-l2 current"><a class="current reference internal" href="">Models</a></li>
<li class="toctree-l2"><a class="reference internal" href="settings.html">Settings</a></li>
<li class="toctree-l2"><a class="reference internal" href="templatetags.html">Template Tags</a></li>
</ul>
</li>
</ul>
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="../_sources/reference/models.txt"
rel="nofollow">Show Source</a></li>
</ul>
<div id="searchbox" style="display: none">
<form class="search" action="../search.html" method="get">
<div class="search-wrapper">
<span class="search-left"></span>
<input class="prettysearch" type="text" name="q" size="18" />
<span class="search-right">&nbsp;</span>
</div>
<input type="submit" value="Search" class="searchbutton" />
<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>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body">
<div class="section" id="models">
<h1>Models<a class="headerlink" href="#models" title="Permalink to this headline">¶</a></h1>
<div class="section" id="categorybase">
<h2>CategoryBase<a class="headerlink" href="#categorybase" title="Permalink to this headline">¶</a></h2>
<dl class="class">
<dt id="CategoryBase">
<em class="property">class </em><tt class="descname">CategoryBase</tt><a class="headerlink" href="#CategoryBase" title="Permalink to this definition">¶</a></dt>
<dd><dl class="attribute">
<dt id="CategoryBase.parent">
<tt class="descname">parent</tt><a class="headerlink" href="#CategoryBase.parent" title="Permalink to this definition">¶</a></dt>
<dd><p><tt class="xref py py-class docutils literal"><span class="pre">TreeForeignKey</span></tt> <tt class="docutils literal"><span class="pre">(self)</span></tt></p>
<p>The category&#8217;s parent category. Leave this blank for an root category.</p>
</dd></dl>
<dl class="attribute">
<dt id="CategoryBase.name">
<tt class="descname">name</tt><a class="headerlink" href="#CategoryBase.name" title="Permalink to this definition">¶</a></dt>
<dd><p><strong>Required</strong> <tt class="docutils literal"><span class="pre">CharField(100)</span></tt></p>
<p>The name of the category.</p>
</dd></dl>
<dl class="attribute">
<dt id="CategoryBase.slug">
<tt class="descname">slug</tt><a class="headerlink" href="#CategoryBase.slug" title="Permalink to this definition">¶</a></dt>
<dd><p><strong>Required</strong> <tt class="docutils literal"><span class="pre">SlugField</span></tt></p>
<p>URL-friendly title. It is automatically generated from the title.</p>
</dd></dl>
<dl class="attribute">
<dt id="CategoryBase.active">
<tt class="descname">active</tt><a class="headerlink" href="#CategoryBase.active" title="Permalink to this definition">¶</a></dt>
<dd><p><strong>Required</strong> <tt class="docutils literal"><span class="pre">BooleanField</span></tt> <em>default:</em> <tt class="xref docutils literal"><span class="pre">True</span></tt></p>
<p>Is this item active. If it is inactive, all children are set to inactive as well.</p>
</dd></dl>
<dl class="attribute">
<dt id="CategoryBase.objects">
<tt class="descname">objects</tt><a class="headerlink" href="#CategoryBase.objects" title="Permalink to this definition">¶</a></dt>
<dd><p><tt class="docutils literal"><span class="pre">CategoryManager</span></tt></p>
<p>An object manager that adds an <tt class="docutils literal"><span class="pre">active</span></tt> method for only selecting items whose <tt class="docutils literal"><span class="pre">active</span></tt> attribute is <tt class="xref docutils literal"><span class="pre">True</span></tt>.</p>
</dd></dl>
<dl class="attribute">
<dt id="CategoryBase.tree">
<tt class="descname">tree</tt><a class="headerlink" href="#CategoryBase.tree" title="Permalink to this definition">¶</a></dt>
<dd><p><tt class="docutils literal"><span class="pre">TreeManager</span></tt></p>
<p>A Django-MPTT <a class="reference external" href="http://readthedocs.org/docs/django-mptt/en/latest/models.html#the-treemanager-custom-manager">TreeManager</a> instance.</p>
</dd></dl>
</dd></dl>
</div>
<div class="section" id="category">
<h2>Category<a class="headerlink" href="#category" title="Permalink to this headline">¶</a></h2>
<dl class="class">
<dt id="Category">
<em class="property">class </em><tt class="descname">Category</tt><a class="headerlink" href="#Category" title="Permalink to this definition">¶</a></dt>
<dd><p>Category is a subclass of <a class="reference internal" href="#CategoryBase" title="CategoryBase"><tt class="xref py py-class docutils literal"><span class="pre">CategoryBase</span></tt></a> and includes all its attributes.</p>
<dl class="attribute">
<dt id="Category.thumbnail">
<tt class="descname">thumbnail</tt><a class="headerlink" href="#Category.thumbnail" title="Permalink to this definition">¶</a></dt>
<dd><p><tt class="docutils literal"><span class="pre">FileField</span></tt></p>
<p>An optional thumbnail, that is uploaded to <a class="reference internal" href="settings.html#thumbnail-upload-path"><em>THUMBNAIL_UPLOAD_PATH</em></a> via <a class="reference internal" href="settings.html#thumbnail-storage"><em>THUMBNAIL_STORAGE</em></a>.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p>Why isn&#8217;t this an <tt class="docutils literal"><span class="pre">ImageField</span></tt>?</p>
<p>For <tt class="docutils literal"><span class="pre">ImageField</span></tt>s, Django checks the file system for the existance of the files to handle the height and width. In many cases this can lead to problems and impact performance.</p>
<p class="last">For these reasons, a <tt class="docutils literal"><span class="pre">FileField</span></tt> that manually manages the width and height was chosen.</p>
</div>
</dd></dl>
<dl class="attribute">
<dt id="Category.thumbnail_width">
<tt class="descname">thumbnail_width</tt><a class="headerlink" href="#Category.thumbnail_width" title="Permalink to this definition">¶</a></dt>
<dd><p><tt class="docutils literal"><span class="pre">IntegerField</span></tt></p>
<p>The thumbnail width. Automatically set on save if a thumbnail is uploaded.</p>
</dd></dl>
<dl class="attribute">
<dt id="Category.thumbnail_height">
<tt class="descname">thumbnail_height</tt><a class="headerlink" href="#Category.thumbnail_height" title="Permalink to this definition">¶</a></dt>
<dd><p><tt class="docutils literal"><span class="pre">IntegerField</span></tt></p>
<p>The thumbnail height. Automatically set on save if a thumbnail is uploaded.</p>
</dd></dl>
<dl class="attribute">
<dt id="Category.order">
<tt class="descname">order</tt><a class="headerlink" href="#Category.order" title="Permalink to this definition">¶</a></dt>
<dd><p><strong>Required</strong> <tt class="docutils literal"><span class="pre">IntegerField</span></tt> <em>default:</em> 0</p>
<p>A manually-managed order of this category in the listing. Items with the same order are sorted alphabetically.</p>
</dd></dl>
<dl class="attribute">
<dt id="Category.alternate_title">
<tt class="descname">alternate_title</tt><a class="headerlink" href="#Category.alternate_title" title="Permalink to this definition">¶</a></dt>
<dd><p><tt class="docutils literal"><span class="pre">CharField(100)</span></tt></p>
<p>An alternative title to use on pages with this category.</p>
</dd></dl>
<dl class="attribute">
<dt id="Category.alternate_url">
<tt class="descname">alternate_url</tt><a class="headerlink" href="#Category.alternate_url" title="Permalink to this definition">¶</a></dt>
<dd><p><tt class="docutils literal"><span class="pre">CharField(200)</span></tt></p>
<p>An alternative URL to use instead of the one derived from the category hierarchy.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p>Why isn&#8217;t this a <tt class="docutils literal"><span class="pre">URLField</span></tt>?</p>
<p class="last">For <tt class="docutils literal"><span class="pre">URLField</span></tt>s, Django checks that the URL includes <tt class="docutils literal"><span class="pre">http://</span></tt> and the site name. This makes it impossible to use relative URLs in that field.</p>
</div>
</dd></dl>
<dl class="attribute">
<dt id="Category.description">
<tt class="descname">description</tt><a class="headerlink" href="#Category.description" title="Permalink to this definition">¶</a></dt>
<dd><p><tt class="docutils literal"><span class="pre">TextField</span></tt></p>
<p>An optional longer description of the category. Very useful on category landing pages.</p>
</dd></dl>
<dl class="attribute">
<dt id="Category.meta_keywords">
<tt class="descname">meta_keywords</tt><a class="headerlink" href="#Category.meta_keywords" title="Permalink to this definition">¶</a></dt>
<dd><p><tt class="docutils literal"><span class="pre">CharField(255)</span></tt></p>
<p>Comma-separated keywords for search engines.</p>
</dd></dl>
<dl class="attribute">
<dt id="Category.meta_extra">
<tt class="descname">meta_extra</tt><a class="headerlink" href="#Category.meta_extra" title="Permalink to this definition">¶</a></dt>
<dd><p><tt class="docutils literal"><span class="pre">TextField</span></tt></p>
<p>(Advanced) Any additional HTML to be placed verbatim in the <tt class="docutils literal"><span class="pre">&lt;head&gt;</span></tt> of the page.</p>
</dd></dl>
</dd></dl>
</div>
</div>
</div>
</div>
</div>
<div class="footer">
<p>
&copy; Copyright 2010-2012, Corey Oordt.
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.5.
</p>
</div>
<div class="clearer"></div>
</div>
<div id="breadcrumbs">
<a href="index.html" accesskey="U">Reference</a><img src="../_static/triangle_closed.png" height="9" width="9" alt="&gt;">
Models
</ul>
</div>
<script type="text/javascript" charset="utf-8" src="../_static/toc.js"></script>
</body>
</html>
Jump to Line
Something went wrong with that request. Please try again.