PageRenderTime 27ms CodeModel.GetById 0ms RepoModel.GetById 0ms app.codeStats 0ms

/docs/reference/models.html

https://bitbucket.org/forcreation/django-categories
HTML | 252 lines | 223 code | 29 blank | 0 comment | 0 complexity | 9d7cf16395279e6a9810ceff398f7616 MD5 | raw file
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  2. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  3. <html xmlns="http://www.w3.org/1999/xhtml">
  4. <head>
  5. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  6. <title>Models &mdash; Django Categories v1.1 documentation</title>
  7. <link rel="stylesheet" href="../_static/default.css" type="text/css" />
  8. <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
  9. <script type="text/javascript">
  10. var DOCUMENTATION_OPTIONS = {
  11. URL_ROOT: '../',
  12. VERSION: '1.1',
  13. COLLAPSE_INDEX: false,
  14. FILE_SUFFIX: '.html',
  15. HAS_SOURCE: true
  16. };
  17. </script>
  18. <script type="text/javascript" src="../_static/jquery.js"></script>
  19. <script type="text/javascript" src="../_static/underscore.js"></script>
  20. <script type="text/javascript" src="../_static/doctools.js"></script>
  21. <link rel="top" title="Django Categories v1.1 documentation" href="../index.html" />
  22. <link rel="up" title="Reference" href="index.html" />
  23. <link rel="next" title="Settings" href="settings.html" />
  24. <link rel="prev" title="Management Commands" href="management_commands.html" />
  25. </head>
  26. <body>
  27. <div id="docstitle">
  28. <p>Django Categories v1.1 documentation</p>
  29. </div>
  30. <div id="header">
  31. <div id="title"><h1>Models</h1></div>
  32. <ul id="headerButtons">
  33. <li id="toc_button"><div class="headerButton"><a href="#">Table of Contents</a></div></li>
  34. <li id="page_buttons">
  35. <div class="headerButton"><a href="../genindex.html" title="General Index" accesskey="I">index</a></div>
  36. <div class="headerButton"><a href="settings.html" title="Settings" accesskey="N">next</a></div>
  37. <div class="headerButton"><a href="management_commands.html" title="Management Commands" accesskey="P">previous</a></div>
  38. </li>
  39. </ul>
  40. </div>
  41. <div id="sphinxsidebar">
  42. <div class="sphinxsidebarwrapper">
  43. <ul><li class="toctree-l1"><a href="../index.html">Main Page</a></li></ul>
  44. <ul class="current">
  45. <li class="toctree-l1"><a class="reference internal" href="../installation.html">Installation</a></li>
  46. <li class="toctree-l1"><a class="reference internal" href="../getting_started.html">Getting Started</a></li>
  47. <li class="toctree-l1"><a class="reference internal" href="../usage.html">Using categories in templates</a></li>
  48. <li class="toctree-l1"><a class="reference internal" href="../registering_models.html">Registering Models</a></li>
  49. <li class="toctree-l1"><a class="reference internal" href="../adding_the_fields.html">Adding the fields to the database</a></li>
  50. <li class="toctree-l1"><a class="reference internal" href="../custom_categories.html">Creating Custom Categories</a></li>
  51. <li class="toctree-l1 current"><a class="reference internal" href="index.html">Reference</a><ul class="current">
  52. <li class="toctree-l2"><a class="reference internal" href="management_commands.html">Management Commands</a></li>
  53. <li class="toctree-l2 current"><a class="current reference internal" href="">Models</a></li>
  54. <li class="toctree-l2"><a class="reference internal" href="settings.html">Settings</a></li>
  55. <li class="toctree-l2"><a class="reference internal" href="templatetags.html">Template tags and filters</a></li>
  56. </ul>
  57. </li>
  58. </ul>
  59. <h3>This Page</h3>
  60. <ul class="this-page-menu">
  61. <li><a href="../_sources/reference/models.txt"
  62. rel="nofollow">Show Source</a></li>
  63. </ul>
  64. <div id="searchbox" style="display: none">
  65. <form class="search" action="../search.html" method="get">
  66. <div class="search-wrapper">
  67. <span class="search-left"></span>
  68. <input class="prettysearch" type="text" name="q" size="18" />
  69. <span class="search-right">&nbsp;</span>
  70. </div>
  71. <input type="submit" value="Search" class="searchbutton" />
  72. <input type="hidden" name="check_keywords" value="yes" />
  73. <input type="hidden" name="area" value="default" />
  74. </form>
  75. <p class="searchtip" style="font-size: 90%">
  76. Enter search terms or a module, class or function name.
  77. </p>
  78. </div>
  79. <script type="text/javascript">$('#searchbox').show(0);</script>
  80. </div>
  81. </div>
  82. <div class="document">
  83. <div class="documentwrapper">
  84. <div class="bodywrapper">
  85. <div class="body">
  86. <div class="section" id="models">
  87. <h1>Models<a class="headerlink" href="#models" title="Permalink to this headline"></a></h1>
  88. <div class="section" id="categorybase">
  89. <h2>CategoryBase<a class="headerlink" href="#categorybase" title="Permalink to this headline"></a></h2>
  90. <dl class="class">
  91. <dt id="CategoryBase">
  92. <em class="property">class </em><tt class="descname">CategoryBase</tt><a class="headerlink" href="#CategoryBase" title="Permalink to this definition"></a></dt>
  93. <dd><dl class="attribute">
  94. <dt id="CategoryBase.parent">
  95. <tt class="descname">parent</tt><a class="headerlink" href="#CategoryBase.parent" title="Permalink to this definition"></a></dt>
  96. <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>
  97. <p>The category&#8217;s parent category. Leave this blank for an root category.</p>
  98. </dd></dl>
  99. <dl class="attribute">
  100. <dt id="CategoryBase.name">
  101. <tt class="descname">name</tt><a class="headerlink" href="#CategoryBase.name" title="Permalink to this definition"></a></dt>
  102. <dd><p><strong>Required</strong> <tt class="docutils literal"><span class="pre">CharField(100)</span></tt></p>
  103. <p>The name of the category.</p>
  104. </dd></dl>
  105. <dl class="attribute">
  106. <dt id="CategoryBase.slug">
  107. <tt class="descname">slug</tt><a class="headerlink" href="#CategoryBase.slug" title="Permalink to this definition"></a></dt>
  108. <dd><p><strong>Required</strong> <tt class="docutils literal"><span class="pre">SlugField</span></tt></p>
  109. <p>URL-friendly title. It is automatically generated from the title.</p>
  110. </dd></dl>
  111. <dl class="attribute">
  112. <dt id="CategoryBase.active">
  113. <tt class="descname">active</tt><a class="headerlink" href="#CategoryBase.active" title="Permalink to this definition"></a></dt>
  114. <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>
  115. <p>Is this item active. If it is inactive, all children are set to inactive as well.</p>
  116. </dd></dl>
  117. <dl class="attribute">
  118. <dt id="CategoryBase.objects">
  119. <tt class="descname">objects</tt><a class="headerlink" href="#CategoryBase.objects" title="Permalink to this definition"></a></dt>
  120. <dd><p><tt class="docutils literal"><span class="pre">CategoryManager</span></tt></p>
  121. <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>
  122. </dd></dl>
  123. <dl class="attribute">
  124. <dt id="CategoryBase.tree">
  125. <tt class="descname">tree</tt><a class="headerlink" href="#CategoryBase.tree" title="Permalink to this definition"></a></dt>
  126. <dd><p><tt class="docutils literal"><span class="pre">TreeManager</span></tt></p>
  127. <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>
  128. </dd></dl>
  129. </dd></dl>
  130. </div>
  131. <div class="section" id="category">
  132. <h2>Category<a class="headerlink" href="#category" title="Permalink to this headline"></a></h2>
  133. <dl class="class">
  134. <dt id="Category">
  135. <em class="property">class </em><tt class="descname">Category</tt><a class="headerlink" href="#Category" title="Permalink to this definition"></a></dt>
  136. <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>
  137. <dl class="attribute">
  138. <dt id="Category.thumbnail">
  139. <tt class="descname">thumbnail</tt><a class="headerlink" href="#Category.thumbnail" title="Permalink to this definition"></a></dt>
  140. <dd><p><tt class="docutils literal"><span class="pre">FileField</span></tt></p>
  141. <p>An optional thumbnail, that is uploaded to <a class="reference internal" href="settings.html#thumbnail-upload-path"><em>REGISTER_ADMIN</em></a> via <a class="reference internal" href="settings.html#thumbnail-storage"><em>THUMBNAIL_STORAGE</em></a>.</p>
  142. <div class="admonition note">
  143. <p class="first admonition-title">Note</p>
  144. <p>Why isn&#8217;t this an <tt class="docutils literal"><span class="pre">ImageField</span></tt>?</p>
  145. <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>
  146. <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>
  147. </div>
  148. </dd></dl>
  149. <dl class="attribute">
  150. <dt id="Category.thumbnail_width">
  151. <tt class="descname">thumbnail_width</tt><a class="headerlink" href="#Category.thumbnail_width" title="Permalink to this definition"></a></dt>
  152. <dd><p><tt class="docutils literal"><span class="pre">IntegerField</span></tt></p>
  153. <p>The thumbnail width. Automatically set on save if a thumbnail is uploaded.</p>
  154. </dd></dl>
  155. <dl class="attribute">
  156. <dt id="Category.thumbnail_height">
  157. <tt class="descname">thumbnail_height</tt><a class="headerlink" href="#Category.thumbnail_height" title="Permalink to this definition"></a></dt>
  158. <dd><p><tt class="docutils literal"><span class="pre">IntegerField</span></tt></p>
  159. <p>The thumbnail height. Automatically set on save if a thumbnail is uploaded.</p>
  160. </dd></dl>
  161. <dl class="attribute">
  162. <dt id="Category.order">
  163. <tt class="descname">order</tt><a class="headerlink" href="#Category.order" title="Permalink to this definition"></a></dt>
  164. <dd><p><strong>Required</strong> <tt class="docutils literal"><span class="pre">IntegerField</span></tt> <em>default:</em> 0</p>
  165. <p>A manually-managed order of this category in the listing. Items with the same order are sorted alphabetically.</p>
  166. </dd></dl>
  167. <dl class="attribute">
  168. <dt id="Category.alternate_title">
  169. <tt class="descname">alternate_title</tt><a class="headerlink" href="#Category.alternate_title" title="Permalink to this definition"></a></dt>
  170. <dd><p><tt class="docutils literal"><span class="pre">CharField(100)</span></tt></p>
  171. <p>An alternative title to use on pages with this category.</p>
  172. </dd></dl>
  173. <dl class="attribute">
  174. <dt id="Category.alternate_url">
  175. <tt class="descname">alternate_url</tt><a class="headerlink" href="#Category.alternate_url" title="Permalink to this definition"></a></dt>
  176. <dd><p><tt class="docutils literal"><span class="pre">CharField(200)</span></tt></p>
  177. <p>An alternative URL to use instead of the one derived from the category hierarchy.</p>
  178. <div class="admonition note">
  179. <p class="first admonition-title">Note</p>
  180. <p>Why isn&#8217;t this a <tt class="docutils literal"><span class="pre">URLField</span></tt>?</p>
  181. <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>
  182. </div>
  183. </dd></dl>
  184. <dl class="attribute">
  185. <dt id="Category.description">
  186. <tt class="descname">description</tt><a class="headerlink" href="#Category.description" title="Permalink to this definition"></a></dt>
  187. <dd><p><tt class="docutils literal"><span class="pre">TextField</span></tt></p>
  188. <p>An optional longer description of the category. Very useful on category landing pages.</p>
  189. </dd></dl>
  190. <dl class="attribute">
  191. <dt id="Category.meta_keywords">
  192. <tt class="descname">meta_keywords</tt><a class="headerlink" href="#Category.meta_keywords" title="Permalink to this definition"></a></dt>
  193. <dd><p><tt class="docutils literal"><span class="pre">CharField(255)</span></tt></p>
  194. <p>Comma-separated keywords for search engines.</p>
  195. </dd></dl>
  196. <dl class="attribute">
  197. <dt id="Category.meta_extra">
  198. <tt class="descname">meta_extra</tt><a class="headerlink" href="#Category.meta_extra" title="Permalink to this definition"></a></dt>
  199. <dd><p><tt class="docutils literal"><span class="pre">TextField</span></tt></p>
  200. <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>
  201. </dd></dl>
  202. </dd></dl>
  203. </div>
  204. </div>
  205. </div>
  206. </div>
  207. </div>
  208. <div class="footer">
  209. <p>
  210. &copy; Copyright 2010-2012, Corey Oordt.
  211. Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.7.
  212. </p>
  213. </div>
  214. <div class="clearer"></div>
  215. </div>
  216. <div id="breadcrumbs">
  217. <a href="index.html" accesskey="U">Reference</a><img src="../_static/triangle_closed.png" height="9" width="9" alt="&gt;">
  218. Models
  219. </ul>
  220. </div>
  221. <script type="text/javascript" charset="utf-8" src="../_static/toc.js"></script>
  222. </body>
  223. </html>