|
-
-
- <!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>model Package — WNFramework v1.8 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.8',
- 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="WNFramework v1.8 documentation" href="index.html" />
- </head>
- <body>
- <div class="related">
- <h3>Navigation</h3>
- <ul>
- <li class="right" style="margin-right: 10px">
- <a href="genindex.html" title="General Index"
- accesskey="I">index</a></li>
- <li class="right" >
- <a href="py-modindex.html" title="Python Module Index"
- >modules</a> |</li>
- <li><a href="index.html">WNFramework v1.8 documentation</a> »</li>
- </ul>
- </div>
-
- <div class="document">
- <div class="documentwrapper">
- <div class="bodywrapper">
- <div class="body">
-
- <div class="section" id="model-package">
- <h1>model Package<a class="headerlink" href="#model-package" title="Permalink to this headline">¶</a></h1>
- <div class="section" id="id1">
- <h2><tt class="xref py py-mod docutils literal"><span class="pre">model</span></tt> Package<a class="headerlink" href="#id1" title="Permalink to this headline">¶</a></h2>
- <span class="target" id="module-webnotes.model"></span><dl class="function">
- <dt id="webnotes.model.check_if_doc_is_linked">
- <tt class="descclassname">webnotes.model.</tt><tt class="descname">check_if_doc_is_linked</tt><big>(</big><em>dt</em>, <em>dn</em><big>)</big><a class="reference internal" href="_modules/webnotes/model.html#check_if_doc_is_linked"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#webnotes.model.check_if_doc_is_linked" title="Permalink to this definition">¶</a></dt>
- <dd><p>Raises excption if the given doc(dt, dn) is linked in another record.</p>
- </dd></dl>
-
- <dl class="function">
- <dt id="webnotes.model.clear_recycle_bin">
- <tt class="descclassname">webnotes.model.</tt><tt class="descname">clear_recycle_bin</tt><big>(</big><big>)</big><a class="reference internal" href="_modules/webnotes/model.html#clear_recycle_bin"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#webnotes.model.clear_recycle_bin" title="Permalink to this definition">¶</a></dt>
- <dd><p>Clears temporary records that have been deleted</p>
- </dd></dl>
-
- <dl class="function">
- <dt id="webnotes.model.copytables">
- <tt class="descclassname">webnotes.model.</tt><tt class="descname">copytables</tt><big>(</big><em>srctype</em>, <em>src</em>, <em>srcfield</em>, <em>tartype</em>, <em>tar</em>, <em>tarfield</em>, <em>srcfields</em>, <em>tarfields=</em><span class="optional">[</span><span class="optional">]</span><big>)</big><a class="reference internal" href="_modules/webnotes/model.html#copytables"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#webnotes.model.copytables" title="Permalink to this definition">¶</a></dt>
- <dd></dd></dl>
-
- <dl class="function">
- <dt id="webnotes.model.db_exists">
- <tt class="descclassname">webnotes.model.</tt><tt class="descname">db_exists</tt><big>(</big><em>dt</em>, <em>dn</em><big>)</big><a class="reference internal" href="_modules/webnotes/model.html#db_exists"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#webnotes.model.db_exists" title="Permalink to this definition">¶</a></dt>
- <dd></dd></dl>
-
- <dl class="function">
- <dt id="webnotes.model.delete_doc">
- <tt class="descclassname">webnotes.model.</tt><tt class="descname">delete_doc</tt><big>(</big><em>doctype=None</em>, <em>name=None</em>, <em>doclist=None</em><big>)</big><a class="reference internal" href="_modules/webnotes/model.html#delete_doc"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#webnotes.model.delete_doc" title="Permalink to this definition">¶</a></dt>
- <dd><p>Deletes a doc(dt, dn) and validates if it is not submitted and not linked in a live record</p>
- </dd></dl>
-
- <dl class="function">
- <dt id="webnotes.model.get_dt_labels">
- <tt class="descclassname">webnotes.model.</tt><tt class="descname">get_dt_labels</tt><big>(</big><big>)</big><a class="reference internal" href="_modules/webnotes/model.html#get_dt_labels"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#webnotes.model.get_dt_labels" title="Permalink to this definition">¶</a></dt>
- <dd></dd></dl>
-
- <dl class="function">
- <dt id="webnotes.model.get_link_fields">
- <tt class="descclassname">webnotes.model.</tt><tt class="descname">get_link_fields</tt><big>(</big><em>dt</em><big>)</big><a class="reference internal" href="_modules/webnotes/model.html#get_link_fields"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#webnotes.model.get_link_fields" title="Permalink to this definition">¶</a></dt>
- <dd><p>Returns linked fields for dt as a tuple of (linked_doctype, linked_field)</p>
- </dd></dl>
-
- <dl class="function">
- <dt id="webnotes.model.get_search_criteria">
- <tt class="descclassname">webnotes.model.</tt><tt class="descname">get_search_criteria</tt><big>(</big><em>dt</em><big>)</big><a class="reference internal" href="_modules/webnotes/model.html#get_search_criteria"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#webnotes.model.get_search_criteria" title="Permalink to this definition">¶</a></dt>
- <dd></dd></dl>
-
- <dl class="function">
- <dt id="webnotes.model.rename">
- <tt class="descclassname">webnotes.model.</tt><tt class="descname">rename</tt><big>(</big><em>dt</em>, <em>old</em>, <em>new</em>, <em>is_doctype=0</em><big>)</big><a class="reference internal" href="_modules/webnotes/model.html#rename"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#webnotes.model.rename" title="Permalink to this definition">¶</a></dt>
- <dd><p>Renames a doc(dt, old) to doc(dt, new) and updates all linked fields of type “Link” or “Select” with “link:”</p>
- </dd></dl>
-
- </div>
- <div class="section" id="module-webnotes.model.code">
- <span id="code-module"></span><h2><tt class="xref py py-mod docutils literal"><span class="pre">code</span></tt> Module<a class="headerlink" href="#module-webnotes.model.code" title="Permalink to this headline">¶</a></h2>
- <p>This is where all the plug-in code is executed. The standard method for DocTypes is declaration of a
- standardized <cite>DocType</cite> class that has the methods of any DocType. When an object is instantiated using the
- <cite>get_obj</cite> method, it creates an instance of the <cite>DocType</cite> class of that particular DocType and sets the
- <cite>doc</cite> and <cite>doclist</cite> attributes that represent the fields (properties) of that record.</p>
- <p>methods in following modules are imported for backward compatibility</p>
- <blockquote>
- <div><ul class="simple">
- <li>webnotes.*</li>
- <li>webnotes.utils.*</li>
- <li>webnotes.model.doc.*</li>
- <li>webnotes.model.doclist.*</li>
- </ul>
- </div></blockquote>
- <dl class="function">
- <dt id="webnotes.model.code.check_syntax">
- <tt class="descclassname">webnotes.model.code.</tt><tt class="descname">check_syntax</tt><big>(</big><em>code</em><big>)</big><a class="reference internal" href="_modules/webnotes/model/code.html#check_syntax"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#webnotes.model.code.check_syntax" title="Permalink to this definition">¶</a></dt>
- <dd></dd></dl>
-
- <dl class="function">
- <dt id="webnotes.model.code.execute">
- <tt class="descclassname">webnotes.model.code.</tt><tt class="descname">execute</tt><big>(</big><em>code</em>, <em>doc=None</em>, <em>doclist=</em><span class="optional">[</span><span class="optional">]</span><big>)</big><a class="reference internal" href="_modules/webnotes/model/code.html#execute"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#webnotes.model.code.execute" title="Permalink to this definition">¶</a></dt>
- <dd><p>Execute the code, if doc is given, then return the instance of the <cite>DocType</cite> class created</p>
- </dd></dl>
-
- <dl class="function">
- <dt id="webnotes.model.code.get_code">
- <tt class="descclassname">webnotes.model.code.</tt><tt class="descname">get_code</tt><big>(</big><em>module</em>, <em>dt</em>, <em>dn</em>, <em>extn</em>, <em>is_static=None</em>, <em>fieldname=None</em><big>)</big><a class="reference internal" href="_modules/webnotes/model/code.html#get_code"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#webnotes.model.code.get_code" title="Permalink to this definition">¶</a></dt>
- <dd></dd></dl>
-
- <dl class="function">
- <dt id="webnotes.model.code.get_custom_script">
- <tt class="descclassname">webnotes.model.code.</tt><tt class="descname">get_custom_script</tt><big>(</big><em>doctype</em>, <em>script_type</em><big>)</big><a class="reference internal" href="_modules/webnotes/model/code.html#get_custom_script"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#webnotes.model.code.get_custom_script" title="Permalink to this definition">¶</a></dt>
- <dd><p>Returns custom script if set in doctype <cite>Custom Script</cite></p>
- </dd></dl>
-
- <dl class="function">
- <dt id="webnotes.model.code.get_obj">
- <tt class="descclassname">webnotes.model.code.</tt><tt class="descname">get_obj</tt><big>(</big><em>dt=None</em>, <em>dn=None</em>, <em>doc=None</em>, <em>doclist=</em><span class="optional">[</span><span class="optional">]</span>, <em>with_children=0</em><big>)</big><a class="reference internal" href="_modules/webnotes/model/code.html#get_obj"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#webnotes.model.code.get_obj" title="Permalink to this definition">¶</a></dt>
- <dd><p>Returns the instantiated <cite>DocType</cite> object. Here you can pass the DocType and name (ID) to get the object.
- If with_children is true, then all child records will be laoded and added in the doclist.</p>
- </dd></dl>
-
- <dl class="function">
- <dt id="webnotes.model.code.get_server_obj">
- <tt class="descclassname">webnotes.model.code.</tt><tt class="descname">get_server_obj</tt><big>(</big><em>doc</em>, <em>doclist=</em><span class="optional">[</span><span class="optional">]</span>, <em>basedoctype=''</em><big>)</big><a class="reference internal" href="_modules/webnotes/model/code.html#get_server_obj"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#webnotes.model.code.get_server_obj" title="Permalink to this definition">¶</a></dt>
- <dd><p>Returns the instantiated <cite>DocType</cite> object. Will also manage caching & compiling</p>
- </dd></dl>
-
- <dl class="function">
- <dt id="webnotes.model.code.run_server_obj">
- <tt class="descclassname">webnotes.model.code.</tt><tt class="descname">run_server_obj</tt><big>(</big><em>server_obj</em>, <em>method_name</em>, <em>arg=None</em><big>)</big><a class="reference internal" href="_modules/webnotes/model/code.html#run_server_obj"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#webnotes.model.code.run_server_obj" title="Permalink to this definition">¶</a></dt>
- <dd><p>Executes a method (<cite>method_name</cite>) from the given object (<cite>server_obj</cite>)</p>
- </dd></dl>
-
- <dl class="function">
- <dt id="webnotes.model.code.updatedb">
- <tt class="descclassname">webnotes.model.code.</tt><tt class="descname">updatedb</tt><big>(</big><em>doctype</em>, <em>userfields=</em><span class="optional">[</span><span class="optional">]</span>, <em>args={}</em><big>)</big><a class="reference internal" href="_modules/webnotes/model/code.html#updatedb"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#webnotes.model.code.updatedb" title="Permalink to this definition">¶</a></dt>
- <dd></dd></dl>
-
- </div>
- <div class="section" id="module-webnotes.model.db_schema">
- <span id="db-schema-module"></span><h2><tt class="xref py py-mod docutils literal"><span class="pre">db_schema</span></tt> Module<a class="headerlink" href="#module-webnotes.model.db_schema" title="Permalink to this headline">¶</a></h2>
- <p>Syncs a database table to the <cite>DocType</cite> (metadata)</p>
- <div class="admonition note">
- <p class="first admonition-title">Note</p>
- <p class="last">This module is only used internally</p>
- </div>
- <dl class="class">
- <dt id="webnotes.model.db_schema.DbColumn">
- <em class="property">class </em><tt class="descclassname">webnotes.model.db_schema.</tt><tt class="descname">DbColumn</tt><big>(</big><em>table</em>, <em>fieldname</em>, <em>fieldtype</em>, <em>length</em>, <em>default</em>, <em>set_index</em>, <em>options</em><big>)</big><a class="reference internal" href="_modules/webnotes/model/db_schema.html#DbColumn"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#webnotes.model.db_schema.DbColumn" title="Permalink to this definition">¶</a></dt>
- <dd><dl class="method">
- <dt id="webnotes.model.db_schema.DbColumn.check">
- <tt class="descname">check</tt><big>(</big><em>current_def</em><big>)</big><a class="reference internal" href="_modules/webnotes/model/db_schema.html#DbColumn.check"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#webnotes.model.db_schema.DbColumn.check" title="Permalink to this definition">¶</a></dt>
- <dd></dd></dl>
-
- <dl class="method">
- <dt id="webnotes.model.db_schema.DbColumn.get_definition">
- <tt class="descname">get_definition</tt><big>(</big><em>with_default=1</em><big>)</big><a class="reference internal" href="_modules/webnotes/model/db_schema.html#DbColumn.get_definition"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#webnotes.model.db_schema.DbColumn.get_definition" title="Permalink to this definition">¶</a></dt>
- <dd></dd></dl>
-
- </dd></dl>
-
- <dl class="class">
- <dt id="webnotes.model.db_schema.DbManager">
- <em class="property">class </em><tt class="descclassname">webnotes.model.db_schema.</tt><tt class="descname">DbManager</tt><big>(</big><em>conn</em><big>)</big><a class="reference internal" href="_modules/webnotes/model/db_schema.html#DbManager"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#webnotes.model.db_schema.DbManager" title="Permalink to this definition">¶</a></dt>
- <dd><p>Basically, a wrapper for oft-used mysql commands. like show tables,databases, variables etc...</p>
- <dl class="docutils">
- <dt>#TODO:</dt>
- <dd>0. Simplify / create settings for the restore database source folder
- 0a. Merge restore database and extract_sql(from webnotes_server_tools).
- 1. Setter and getter for different mysql variables.
- 2. Setter and getter for mysql variables at global level??</dd>
- </dl>
- <dl class="method">
- <dt id="webnotes.model.db_schema.DbManager.create_database">
- <tt class="descname">create_database</tt><big>(</big><em>target</em><big>)</big><a class="reference internal" href="_modules/webnotes/model/db_schema.html#DbManager.create_database"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#webnotes.model.db_schema.DbManager.create_database" title="Permalink to this definition">¶</a></dt>
- <dd></dd></dl>
-
- <dl class="method">
- <dt id="webnotes.model.db_schema.DbManager.create_user">
- <tt class="descname">create_user</tt><big>(</big><em>user</em>, <em>password</em><big>)</big><a class="reference internal" href="_modules/webnotes/model/db_schema.html#DbManager.create_user"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#webnotes.model.db_schema.DbManager.create_user" title="Permalink to this definition">¶</a></dt>
- <dd></dd></dl>
-
- <dl class="method">
- <dt id="webnotes.model.db_schema.DbManager.delete_user">
- <tt class="descname">delete_user</tt><big>(</big><em>target</em><big>)</big><a class="reference internal" href="_modules/webnotes/model/db_schema.html#DbManager.delete_user"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#webnotes.model.db_schema.DbManager.delete_user" title="Permalink to this definition">¶</a></dt>
- <dd></dd></dl>
-
- <dl class="method">
- <dt id="webnotes.model.db_schema.DbManager.drop_all_databases">
- <tt class="descname">drop_all_databases</tt><big>(</big><big>)</big><a class="reference internal" href="_modules/webnotes/model/db_schema.html#DbManager.drop_all_databases"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#webnotes.model.db_schema.DbManager.drop_all_databases" title="Permalink to this definition">¶</a></dt>
- <dd><p>Danger: will delete all databases except test,mysql.</p>
- </dd></dl>
-
- <dl class="method">
- <dt id="webnotes.model.db_schema.DbManager.drop_database">
- <tt class="descname">drop_database</tt><big>(</big><em>target</em><big>)</big><a class="reference internal" href="_modules/webnotes/model/db_schema.html#DbManager.drop_database"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#webnotes.model.db_schema.DbManager.drop_database" title="Permalink to this definition">¶</a></dt>
- <dd></dd></dl>
-
- <dl class="method">
- <dt id="webnotes.model.db_schema.DbManager.drop_table">
- <tt class="descname">drop_table</tt><big>(</big><em>table_name</em><big>)</big><a class="reference internal" href="_modules/webnotes/model/db_schema.html#DbManager.drop_table"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#webnotes.model.db_schema.DbManager.drop_table" title="Permalink to this definition">¶</a></dt>
- <dd></dd></dl>
-
- <dl class="method">
- <dt id="webnotes.model.db_schema.DbManager.flush_privileges">
- <tt class="descname">flush_privileges</tt><big>(</big><big>)</big><a class="reference internal" href="_modules/webnotes/model/db_schema.html#DbManager.flush_privileges"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#webnotes.model.db_schema.DbManager.flush_privileges" title="Permalink to this definition">¶</a></dt>
- <dd></dd></dl>
-
- <dl class="method">
- <dt id="webnotes.model.db_schema.DbManager.get_database_list">
- <tt class="descname">get_database_list</tt><big>(</big><big>)</big><a class="reference internal" href="_modules/webnotes/model/db_schema.html#DbManager.get_database_list"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#webnotes.model.db_schema.DbManager.get_database_list" title="Permalink to this definition">¶</a></dt>
- <dd></dd></dl>
-
- <dl class="method">
- <dt id="webnotes.model.db_schema.DbManager.get_table_schema">
- <tt class="descname">get_table_schema</tt><big>(</big><em>table</em><big>)</big><a class="reference internal" href="_modules/webnotes/model/db_schema.html#DbManager.get_table_schema"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#webnotes.model.db_schema.DbManager.get_table_schema" title="Permalink to this definition">¶</a></dt>
- <dd><p>Just returns the output of Desc tables.</p>
- </dd></dl>
-
- <dl class="method">
- <dt id="webnotes.model.db_schema.DbManager.get_tables_list">
- <tt class="descname">get_tables_list</tt><big>(</big><em>target</em><big>)</big><a class="reference internal" href="_modules/webnotes/model/db_schema.html#DbManager.get_tables_list"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#webnotes.model.db_schema.DbManager.get_tables_list" title="Permalink to this definition">¶</a></dt>
- <dd></dd></dl>
-
- <dl class="method">
- <dt id="webnotes.model.db_schema.DbManager.get_variables">
- <tt class="descname">get_variables</tt><big>(</big><em>regex</em><big>)</big><a class="reference internal" href="_modules/webnotes/model/db_schema.html#DbManager.get_variables"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#webnotes.model.db_schema.DbManager.get_variables" title="Permalink to this definition">¶</a></dt>
- <dd><p>Get variables that match the passed pattern regex</p>
- </dd></dl>
-
- <dl class="method">
- <dt id="webnotes.model.db_schema.DbManager.grant_all_privileges">
- <tt class="descname">grant_all_privileges</tt><big>(</big><em>target</em>, <em>user</em><big>)</big><a class="reference internal" href="_modules/webnotes/model/db_schema.html#DbManager.grant_all_privileges"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#webnotes.model.db_schema.DbManager.grant_all_privileges" title="Permalink to this definition">¶</a></dt>
- <dd></dd></dl>
-
- <dl class="method">
- <dt id="webnotes.model.db_schema.DbManager.grant_select_privilges">
- <tt class="descname">grant_select_privilges</tt><big>(</big><em>db</em>, <em>table</em>, <em>user</em><big>)</big><a class="reference internal" href="_modules/webnotes/model/db_schema.html#DbManager.grant_select_privilges"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#webnotes.model.db_schema.DbManager.grant_select_privilges" title="Permalink to this definition">¶</a></dt>
- <dd></dd></dl>
-
- <dl class="method">
- <dt id="webnotes.model.db_schema.DbManager.restore_database">
- <tt class="descname">restore_database</tt><big>(</big><em>target</em>, <em>source</em>, <em>root_password</em><big>)</big><a class="reference internal" href="_modules/webnotes/model/db_schema.html#DbManager.restore_database"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#webnotes.model.db_schema.DbManager.restore_database" title="Permalink to this definition">¶</a></dt>
- <dd></dd></dl>
-
- <dl class="method">
- <dt id="webnotes.model.db_schema.DbManager.set_transaction_isolation_level">
- <tt class="descname">set_transaction_isolation_level</tt><big>(</big><em>scope='SESSION'</em>, <em>level='READ COMMITTED'</em><big>)</big><a class="reference internal" href="_modules/webnotes/model/db_schema.html#DbManager.set_transaction_isolation_level"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#webnotes.model.db_schema.DbManager.set_transaction_isolation_level" title="Permalink to this definition">¶</a></dt>
- <dd></dd></dl>
-
- </dd></dl>
-
- <dl class="class">
- <dt id="webnotes.model.db_schema.DbTable">
- <em class="property">class </em><tt class="descclassname">webnotes.model.db_schema.</tt><tt class="descname">DbTable</tt><big>(</big><em>doctype</em>, <em>prefix='tab'</em><big>)</big><a class="reference internal" href="_modules/webnotes/model/db_schema.html#DbTable"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#webnotes.model.db_schema.DbTable" title="Permalink to this definition">¶</a></dt>
- <dd><dl class="method">
- <dt id="webnotes.model.db_schema.DbTable.alter">
- <tt class="descname">alter</tt><big>(</big><big>)</big><a class="reference internal" href="_modules/webnotes/model/db_schema.html#DbTable.alter"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#webnotes.model.db_schema.DbTable.alter" title="Permalink to this definition">¶</a></dt>
- <dd></dd></dl>
-
- <dl class="method">
- <dt id="webnotes.model.db_schema.DbTable.create">
- <tt class="descname">create</tt><big>(</big><big>)</big><a class="reference internal" href="_modules/webnotes/model/db_schema.html#DbTable.create"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#webnotes.model.db_schema.DbTable.create" title="Permalink to this definition">¶</a></dt>
- <dd></dd></dl>
-
- <dl class="method">
- <dt id="webnotes.model.db_schema.DbTable.drop_foreign_keys">
- <tt class="descname">drop_foreign_keys</tt><big>(</big><big>)</big><a class="reference internal" href="_modules/webnotes/model/db_schema.html#DbTable.drop_foreign_keys"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#webnotes.model.db_schema.DbTable.drop_foreign_keys" title="Permalink to this definition">¶</a></dt>
- <dd></dd></dl>
-
- <dl class="method">
- <dt id="webnotes.model.db_schema.DbTable.get_column_definitions">
- <tt class="descname">get_column_definitions</tt><big>(</big><big>)</big><a class="reference internal" href="_modules/webnotes/model/db_schema.html#DbTable.get_column_definitions"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#webnotes.model.db_schema.DbTable.get_column_definitions" title="Permalink to this definition">¶</a></dt>
- <dd></dd></dl>
-
- <dl class="method">
- <dt id="webnotes.model.db_schema.DbTable.get_columns_from_db">
- <tt class="descname">get_columns_from_db</tt><big>(</big><big>)</big><a class="reference internal" href="_modules/webnotes/model/db_schema.html#DbTable.get_columns_from_db"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#webnotes.model.db_schema.DbTable.get_columns_from_db" title="Permalink to this definition">¶</a></dt>
- <dd></dd></dl>
-
- <dl class="method">
- <dt id="webnotes.model.db_schema.DbTable.get_columns_from_docfields">
- <tt class="descname">get_columns_from_docfields</tt><big>(</big><big>)</big><a class="reference internal" href="_modules/webnotes/model/db_schema.html#DbTable.get_columns_from_docfields"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#webnotes.model.db_schema.DbTable.get_columns_from_docfields" title="Permalink to this definition">¶</a></dt>
- <dd></dd></dl>
-
- <dl class="method">
- <dt id="webnotes.model.db_schema.DbTable.get_foreign_keys">
- <tt class="descname">get_foreign_keys</tt><big>(</big><big>)</big><a class="reference internal" href="_modules/webnotes/model/db_schema.html#DbTable.get_foreign_keys"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#webnotes.model.db_schema.DbTable.get_foreign_keys" title="Permalink to this definition">¶</a></dt>
- <dd></dd></dl>
-
- <dl class="method">
- <dt id="webnotes.model.db_schema.DbTable.get_index_definitions">
- <tt class="descname">get_index_definitions</tt><big>(</big><big>)</big><a class="reference internal" href="_modules/webnotes/model/db_schema.html#DbTable.get_index_definitions"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#webnotes.model.db_schema.DbTable.get_index_definitions" title="Permalink to this definition">¶</a></dt>
- <dd></dd></dl>
-
- <dl class="method">
- <dt id="webnotes.model.db_schema.DbTable.sync">
- <tt class="descname">sync</tt><big>(</big><big>)</big><a class="reference internal" href="_modules/webnotes/model/db_schema.html#DbTable.sync"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#webnotes.model.db_schema.DbTable.sync" title="Permalink to this definition">¶</a></dt>
- <dd></dd></dl>
-
- </dd></dl>
-
- <dl class="function">
- <dt id="webnotes.model.db_schema.remove_all_foreign_keys">
- <tt class="descclassname">webnotes.model.db_schema.</tt><tt class="descname">remove_all_foreign_keys</tt><big>(</big><big>)</big><a class="reference internal" href="_modules/webnotes/model/db_schema.html#remove_all_foreign_keys"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#webnotes.model.db_schema.remove_all_foreign_keys" title="Permalink to this definition">¶</a></dt>
- <dd></dd></dl>
-
- <dl class="function">
- <dt id="webnotes.model.db_schema.updatedb">
- <tt class="descclassname">webnotes.model.db_schema.</tt><tt class="descname">updatedb</tt><big>(</big><em>dt</em>, <em>archive=0</em><big>)</big><a class="reference internal" href="_modules/webnotes/model/db_schema.html#updatedb"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#webnotes.model.db_schema.updatedb" title="Permalink to this definition">¶</a></dt>
- <dd><dl class="docutils">
- <dt>Syncs a <cite>DocType</cite> to the table</dt>
- <dd><ul class="first last simple">
- <li>creates if required</li>
- <li>updates columns</li>
- <li>updates indices</li>
- </ul>
- </dd>
- </dl>
- </dd></dl>
-
- <dl class="function">
- <dt id="webnotes.model.db_schema.validate_column_name">
- <tt class="descclassname">webnotes.model.db_schema.</tt><tt class="descname">validate_column_name</tt><big>(</big><em>n</em><big>)</big><a class="reference internal" href="_modules/webnotes/model/db_schema.html#validate_column_name"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#webnotes.model.db_schema.validate_column_name" title="Permalink to this definition">¶</a></dt>
- <dd></dd></dl>
-
- </div>
- <div class="section" id="module-webnotes.model.doc">
- <span id="doc-module"></span><h2><tt class="xref py py-mod docutils literal"><span class="pre">doc</span></tt> Module<a class="headerlink" href="#module-webnotes.model.doc" title="Permalink to this headline">¶</a></h2>
- <p>Contains the Document class representing an object / record</p>
- <dl class="class">
- <dt id="webnotes.model.doc.Document">
- <em class="property">class </em><tt class="descclassname">webnotes.model.doc.</tt><tt class="descname">Document</tt><big>(</big><em>doctype=''</em>, <em>name=''</em>, <em>fielddata={}</em>, <em>prefix='tab'</em><big>)</big><a class="reference internal" href="_modules/webnotes/model/doc.html#Document"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#webnotes.model.doc.Document" title="Permalink to this definition">¶</a></dt>
- <dd><p>The wn(meta-data)framework equivalent of a Database Record.
- Stores,Retrieves,Updates the record in the corresponding table.
- Runs the triggers required.</p>
- <p>The <cite>Document</cite> class represents the basic Object-Relational Mapper (ORM). The object type is defined by
- <cite>DocType</cite> and the object ID is represented by <cite>name</cite>:</p>
- <div class="highlight-python"><pre>Please note the anamoly in the Web Notes Framework that `ID` is always called as `name`</pre>
- </div>
- <p>If both <cite>doctype</cite> and <cite>name</cite> are specified in the constructor, then the object is loaded from the database.
- If only <cite>doctype</cite> is given, then the object is not loaded
- If <cite>fielddata</cite> is specfied, then the object is created from the given dictionary.</p>
- <blockquote>
- <div><p><strong>Note 1:</strong></p>
- <blockquote>
- <div><p>The getter and setter of the object are overloaded to map to the fields of the object that
- are loaded when it is instantiated.</p>
- <p>For example: doc.name will be the <cite>name</cite> field and doc.owner will be the <cite>owner</cite> field</p>
- </div></blockquote>
- <p><strong>Note 2 - Standard Fields:</strong></p>
- <blockquote>
- <div><ul class="simple">
- <li><cite>name</cite>: ID / primary key</li>
- <li><cite>owner</cite>: creator of the record</li>
- <li><cite>creation</cite>: datetime of creation</li>
- <li><cite>modified</cite>: datetime of last modification</li>
- <li><cite>modified_by</cite> : last updating user</li>
- <li><cite>docstatus</cite> : Status 0 - Saved, 1 - Submitted, 2- Cancelled</li>
- <li><cite>parent</cite> : if child (table) record, this represents the parent record</li>
- <li><cite>parenttype</cite> : type of parent record (if any)</li>
- <li><cite>parentfield</cite> : table fieldname of parent record (if any)</li>
- <li><cite>idx</cite> : Index (sequence) of the child record</li>
- </ul>
- </div></blockquote>
- </div></blockquote>
- <dl class="method">
- <dt id="webnotes.model.doc.Document.addchild">
- <tt class="descname">addchild</tt><big>(</big><em>fieldname</em>, <em>childtype=''</em>, <em>local=0</em>, <em>doclist=None</em><big>)</big><a class="reference internal" href="_modules/webnotes/model/doc.html#Document.addchild"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#webnotes.model.doc.Document.addchild" title="Permalink to this definition">¶</a></dt>
- <dd><p>Returns a child record of the give <cite>childtype</cite>.</p>
- <ul class="simple">
- <li>if local is set, it does not save the record</li>
- <li>if doclist is passed, it append the record to the doclist</li>
- </ul>
- </dd></dl>
-
- <dl class="method">
- <dt id="webnotes.model.doc.Document.check_perm">
- <tt class="descname">check_perm</tt><big>(</big><em>verbose=0</em><big>)</big><a class="reference internal" href="_modules/webnotes/model/doc.html#Document.check_perm"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#webnotes.model.doc.Document.check_perm" title="Permalink to this definition">¶</a></dt>
- <dd></dd></dl>
-
- <dl class="method">
- <dt id="webnotes.model.doc.Document.clear_table">
- <tt class="descname">clear_table</tt><big>(</big><em>doclist</em>, <em>tablefield</em>, <em>save=0</em><big>)</big><a class="reference internal" href="_modules/webnotes/model/doc.html#Document.clear_table"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#webnotes.model.doc.Document.clear_table" title="Permalink to this definition">¶</a></dt>
- <dd><p>Clears the child records from the given <cite>doclist</cite> for a particular <cite>tablefield</cite></p>
- </dd></dl>
-
- <dl class="method">
- <dt id="webnotes.model.doc.Document.make_link_list">
- <tt class="descname">make_link_list</tt><big>(</big><big>)</big><a class="reference internal" href="_modules/webnotes/model/doc.html#Document.make_link_list"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#webnotes.model.doc.Document.make_link_list" title="Permalink to this definition">¶</a></dt>
- <dd></dd></dl>
-
- <dl class="method">
- <dt id="webnotes.model.doc.Document.save">
- <tt class="descname">save</tt><big>(</big><em>new=0</em>, <em>check_links=1</em>, <em>ignore_fields=0</em>, <em>make_autoname=1</em><big>)</big><a class="reference internal" href="_modules/webnotes/model/doc.html#Document.save"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#webnotes.model.doc.Document.save" title="Permalink to this definition">¶</a></dt>
- <dd><p>Saves the current record in the database. If new = 1, creates a new instance of the record.
- Also clears temperory fields starting with <cite>__</cite></p>
- <ul class="simple">
- <li>if check_links is set, it validates all <cite>Link</cite> fields</li>
- <li>if ignore_fields is sets, it does not throw an exception for any field that does not exist in the
- database table</li>
- </ul>
- </dd></dl>
-
- <dl class="method">
- <dt id="webnotes.model.doc.Document.validate_links">
- <tt class="descname">validate_links</tt><big>(</big><em>link_list</em><big>)</big><a class="reference internal" href="_modules/webnotes/model/doc.html#Document.validate_links"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#webnotes.model.doc.Document.validate_links" title="Permalink to this definition">¶</a></dt>
- <dd></dd></dl>
-
- </dd></dl>
-
- <dl class="class">
- <dt id="webnotes.model.doc.SuperDocType">
- <em class="property">class </em><tt class="descclassname">webnotes.model.doc.</tt><tt class="descname">SuperDocType</tt><a class="reference internal" href="_modules/webnotes/model/doc.html#SuperDocType"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#webnotes.model.doc.SuperDocType" title="Permalink to this definition">¶</a></dt>
- <dd></dd></dl>
-
- <dl class="function">
- <dt id="webnotes.model.doc.addchild">
- <tt class="descclassname">webnotes.model.doc.</tt><tt class="descname">addchild</tt><big>(</big><em>parent</em>, <em>fieldname</em>, <em>childtype=''</em>, <em>local=0</em>, <em>doclist=None</em><big>)</big><a class="reference internal" href="_modules/webnotes/model/doc.html#addchild"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#webnotes.model.doc.addchild" title="Permalink to this definition">¶</a></dt>
- <dd><p>Create a child record to the parent doc.</p>
- <p>Example:</p>
- <div class="highlight-python"><div class="highlight"><pre><span class="n">c</span> <span class="o">=</span> <span class="n">Document</span><span class="p">(</span><span class="s">'Contact'</span><span class="p">,</span><span class="s">'ABC'</span><span class="p">)</span>
- <span class="n">d</span> <span class="o">=</span> <span class="n">addchild</span><span class="p">(</span><span class="n">c</span><span class="p">,</span> <span class="s">'contact_updates'</span><span class="p">,</span> <span class="s">'Contact Update'</span><span class="p">,</span> <span class="n">local</span> <span class="o">=</span> <span class="mi">1</span><span class="p">)</span>
- <span class="n">d</span><span class="o">.</span><span class="n">last_updated</span> <span class="o">=</span> <span class="s">'Phone call'</span>
- <span class="n">d</span><span class="o">.</span><span class="n">save</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span>
- </pre></div>
- </div>
- </dd></dl>
-
- <dl class="function">
- <dt id="webnotes.model.doc.check_page_perm">
- <tt class="descclassname">webnotes.model.doc.</tt><tt class="descname">check_page_perm</tt><big>(</big><em>doc</em><big>)</big><a class="reference internal" href="_modules/webnotes/model/doc.html#check_page_perm"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#webnotes.model.doc.check_page_perm" title="Permalink to this definition">¶</a></dt>
- <dd></dd></dl>
-
- <dl class="function">
- <dt id="webnotes.model.doc.get">
- <tt class="descclassname">webnotes.model.doc.</tt><tt class="descname">get</tt><big>(</big><em>dt</em>, <em>dn=''</em>, <em>with_children=1</em>, <em>from_get_obj=0</em>, <em>prefix='tab'</em><big>)</big><a class="reference internal" href="_modules/webnotes/model/doc.html#get"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#webnotes.model.doc.get" title="Permalink to this definition">¶</a></dt>
- <dd><p>Returns a doclist containing the main record and all child records</p>
- </dd></dl>
-
- <dl class="function">
- <dt id="webnotes.model.doc.get_report_builder_code">
- <tt class="descclassname">webnotes.model.doc.</tt><tt class="descname">get_report_builder_code</tt><big>(</big><em>doc</em><big>)</big><a class="reference internal" href="_modules/webnotes/model/doc.html#get_report_builder_code"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#webnotes.model.doc.get_report_builder_code" title="Permalink to this definition">¶</a></dt>
- <dd></dd></dl>
-
- <dl class="function">
- <dt id="webnotes.model.doc.getchildren">
- <tt class="descclassname">webnotes.model.doc.</tt><tt class="descname">getchildren</tt><big>(</big><em>name</em>, <em>childtype</em>, <em>field=''</em>, <em>parenttype=''</em>, <em>from_doctype=0</em>, <em>prefix='tab'</em><big>)</big><a class="reference internal" href="_modules/webnotes/model/doc.html#getchildren"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#webnotes.model.doc.getchildren" title="Permalink to this definition">¶</a></dt>
- <dd></dd></dl>
-
- <dl class="function">
- <dt id="webnotes.model.doc.getseries">
- <tt class="descclassname">webnotes.model.doc.</tt><tt class="descname">getseries</tt><big>(</big><em>key</em>, <em>digits</em>, <em>doctype=''</em><big>)</big><a class="reference internal" href="_modules/webnotes/model/doc.html#getseries"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#webnotes.model.doc.getseries" title="Permalink to this definition">¶</a></dt>
- <dd></dd></dl>
-
- <dl class="function">
- <dt id="webnotes.model.doc.make_autoname">
- <tt class="descclassname">webnotes.model.doc.</tt><tt class="descname">make_autoname</tt><big>(</big><em>key</em>, <em>doctype=''</em><big>)</big><a class="reference internal" href="_modules/webnotes/model/doc.html#make_autoname"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#webnotes.model.doc.make_autoname" title="Permalink to this definition">¶</a></dt>
- <dd><p>Creates an autoname from the given key:</p>
- <p><strong>Autoname rules:</strong></p>
- <blockquote>
- <div><ul>
- <li><p class="first">The key is separated by ‘.’</p>
- </li>
- <li><dl class="first docutils">
- <dt>‘####’ represents a series. The string before this part becomes the prefix:</dt>
- <dd><p class="first last">Example: ABC.#### creates a series ABC0001, ABC0002 etc</p>
- </dd>
- </dl>
- </li>
- <li><p class="first">‘MM’ represents the current month</p>
- </li>
- <li><p class="first">‘YY’ and ‘YYYY’ represent the current year</p>
- </li>
- </ul>
- </div></blockquote>
- <p><em>Example:</em></p>
- <blockquote>
- <div><ul class="simple">
- <li>DE/./.YY./.MM./.##### will create a series like
- DE/09/01/0001 where 09 is the year, 01 is the month and 0001 is the series</li>
- </ul>
- </div></blockquote>
- </dd></dl>
-
- <dl class="function">
- <dt id="webnotes.model.doc.removechild">
- <tt class="descclassname">webnotes.model.doc.</tt><tt class="descname">removechild</tt><big>(</big><em>d</em>, <em>is_local=0</em><big>)</big><a class="reference internal" href="_modules/webnotes/model/doc.html#removechild"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#webnotes.model.doc.removechild" title="Permalink to this definition">¶</a></dt>
- <dd><p>Sets the docstatus of the object d to 2 (deleted) and appends an ‘old_parent:’ to the parent name</p>
- </dd></dl>
-
- </div>
- <div class="section" id="module-webnotes.model.doclist">
- <span id="doclist-module"></span><h2><tt class="xref py py-mod docutils literal"><span class="pre">doclist</span></tt> Module<a class="headerlink" href="#module-webnotes.model.doclist" title="Permalink to this headline">¶</a></h2>
- <dl class="function">
- <dt id="webnotes.model.doclist.compress">
- <tt class="descclassname">webnotes.model.doclist.</tt><tt class="descname">compress</tt><big>(</big><em>doclist</em><big>)</big><a class="reference internal" href="_modules/webnotes/model/doclist.html#compress"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#webnotes.model.doclist.compress" title="Permalink to this definition">¶</a></dt>
- <dd><p>Compress a doclist before sending it to the client side. (Internally used by the request handler)</p>
- </dd></dl>
-
- <dl class="function">
- <dt id="webnotes.model.doclist.copy_doclist">
- <tt class="descclassname">webnotes.model.doclist.</tt><tt class="descname">copy_doclist</tt><big>(</big><em>doclist</em>, <em>no_copy=</em><span class="optional">[</span><span class="optional">]</span><big>)</big><a class="reference internal" href="_modules/webnotes/model/doclist.html#copy_doclist"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#webnotes.model.doclist.copy_doclist" title="Permalink to this definition">¶</a></dt>
- <dd><p>Save & return a copy of the given doclist
- Pass fields that are not to be copied in <cite>no_copy</cite></p>
- </dd></dl>
-
- <dl class="function">
- <dt id="webnotes.model.doclist.expand">
- <tt class="descclassname">webnotes.model.doclist.</tt><tt class="descname">expand</tt><big>(</big><em>docs</em><big>)</big><a class="reference internal" href="_modules/webnotes/model/doclist.html#expand"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#webnotes.model.doclist.expand" title="Permalink to this definition">¶</a></dt>
- <dd><p>Expand a doclist sent from the client side. (Internally used by the request handler)</p>
- </dd></dl>
-
- <dl class="function">
- <dt id="webnotes.model.doclist.getlist">
- <tt class="descclassname">webnotes.model.doclist.</tt><tt class="descname">getlist</tt><big>(</big><em>doclist</em>, <em>field</em><big>)</big><a class="reference internal" href="_modules/webnotes/model/doclist.html#getlist"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#webnotes.model.doclist.getlist" title="Permalink to this definition">¶</a></dt>
- <dd><p>Filter a list of records for a specific field from the full doclist</p>
- <p>Example:</p>
- <div class="highlight-python"><div class="highlight"><pre><span class="c"># find all phone call details </span>
- <span class="n">dl</span> <span class="o">=</span> <span class="n">getlist</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">doclist</span><span class="p">,</span> <span class="s">'contact_updates'</span><span class="p">)</span>
- <span class="n">pl</span> <span class="o">=</span> <span class="p">[]</span>
- <span class="k">for</span> <span class="n">d</span> <span class="ow">in</span> <span class="n">dl</span><span class="p">:</span>
- <span class="k">if</span> <span class="n">d</span><span class="o">.</span><span class="n">type</span><span class="o">==</span><span class="s">'Phone'</span><span class="p">:</span>
- <span class="n">pl</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">d</span><span class="p">)</span>
- </pre></div>
- </div>
- </dd></dl>
-
- <dl class="function">
- <dt id="webnotes.model.doclist.getvaluelist">
- <tt class="descclassname">webnotes.model.doclist.</tt><tt class="descname">getvaluelist</tt><big>(</big><em>doclist</em>, <em>fieldname</em><big>)</big><a class="reference internal" href="_modules/webnotes/model/doclist.html#getvaluelist"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#webnotes.model.doclist.getvaluelist" title="Permalink to this definition">¶</a></dt>
- <dd><p>Returns a list of values of a particualr fieldname from all Document object in a doclist</p>
- </dd></dl>
-
- <dl class="function">
- <dt id="webnotes.model.doclist.to_html">
- <tt class="descclassname">webnotes.model.doclist.</tt><tt class="descname">to_html</tt><big>(</big><em>doclist</em><big>)</big><a class="reference internal" href="_modules/webnotes/model/doclist.html#to_html"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#webnotes.model.doclist.to_html" title="Permalink to this definition">¶</a></dt>
- <dd><p>Return a simple HTML format of the doclist</p>
- </dd></dl>
-
- <dl class="function">
- <dt id="webnotes.model.doclist.validate_links_doclist">
- <tt class="descclassname">webnotes.model.doclist.</tt><tt class="descname">validate_links_doclist</tt><big>(</big><em>doclist</em><big>)</big><a class="reference internal" href="_modules/webnotes/model/doclist.html#validate_links_doclist"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#webnotes.model.doclist.validate_links_doclist" title="Permalink to this definition">¶</a></dt>
- <dd><p>Validate link fields and return link fields that are not correct.
- Calls the <cite>validate_links</cite> function on the Document object</p>
- </dd></dl>
-
- <dl class="function">
- <dt id="webnotes.model.doclist.xzip">
- <tt class="descclassname">webnotes.model.doclist.</tt><tt class="descname">xzip</tt><big>(</big><em>a</em>, <em>b</em><big>)</big><a class="reference internal" href="_modules/webnotes/model/doclist.html#xzip"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#webnotes.model.doclist.xzip" title="Permalink to this definition">¶</a></dt>
- <dd></dd></dl>
-
- </div>
- <div class="section" id="module-webnotes.model.doctype">
- <span id="doctype-module"></span><h2><tt class="xref py py-mod docutils literal"><span class="pre">doctype</span></tt> Module<a class="headerlink" href="#module-webnotes.model.doctype" title="Permalink to this headline">¶</a></h2>
- <div class="section" id="id2">
- <h3>DocType module<a class="headerlink" href="#id2" title="Permalink to this headline">¶</a></h3>
- <p>This module has the DocType class that represents a “DocType” as metadata.
- This is usually called by the form builder or report builder.</p>
- <dl class="docutils">
- <dt>Key functions:</dt>
- <dd><ul class="first last simple">
- <li>manage cache - read / write</li>
- <li>merge client-side scripts</li>
- <li>update properties from the modules .txt files</li>
- </ul>
- </dd>
- <dt>Cache management:</dt>
- <dd><ul class="first last simple">
- <li>Cache is stored in __DocTypeCache</li>
- </ul>
- </dd>
- </dl>
- <dl class="function">
- <dt id="webnotes.model.doctype.clear_cache">
- <tt class="descclassname">webnotes.model.doctype.</tt><tt class="descname">clear_cache</tt><big>(</big><big>)</big><a class="reference internal" href="_modules/webnotes/model/doctype.html#clear_cache"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#webnotes.model.doctype.clear_cache" title="Permalink to this definition">¶</a></dt>
- <dd></dd></dl>
-
- <dl class="function">
- <dt id="webnotes.model.doctype.get">
- <tt class="descclassname">webnotes.model.doctype.</tt><tt class="descname">get</tt><big>(</big><em>dt</em><big>)</big><a class="reference internal" href="_modules/webnotes/model/doctype.html#get"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#webnotes.model.doctype.get" title="Permalink to this definition">¶</a></dt>
- <dd><p>Load “DocType” - called by form builder, report buider and from code.py (when there is no cache)</p>
- </dd></dl>
-
- </div>
- </div>
- <div class="section" id="module-webnotes.model.import_docs">
- <span id="import-docs-module"></span><h2><tt class="xref py py-mod docutils literal"><span class="pre">import_docs</span></tt> Module<a class="headerlink" href="#module-webnotes.model.import_docs" title="Permalink to this headline">¶</a></h2>
- <dl class="class">
- <dt id="webnotes.model.import_docs.CSVImport">
- <em class="property">class </em><tt class="descclassname">webnotes.model.import_docs.</tt><tt class="descname">CSVImport</tt><a class="reference internal" href="_modules/webnotes/model/import_docs.html#CSVImport"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#webnotes.model.import_docs.CSVImport" title="Permalink to this definition">¶</a></dt>
- <dd><dl class="method">
- <dt id="webnotes.model.import_docs.CSVImport.check_select_link_data">
- <tt class="descname">check_select_link_data</tt><big>(</big><em>r</em>, <em>c</em>, <em>f</em>, <em>d</em>, <em>s=''</em>, <em>l=''</em><big>)</big><a class="reference internal" href="_modules/webnotes/model/import_docs.html#CSVImport.check_select_link_data"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#webnotes.model.import_docs.CSVImport.check_select_link_data" title="Permalink to this definition">¶</a></dt>
- <dd></dd></dl>
-
- <dl class="method">
- <dt id="webnotes.model.import_docs.CSVImport.convert_csv_data_into_list">
- <tt class="descname">convert_csv_data_into_list</tt><big>(</big><em>csv_data</em><big>)</big><a class="reference internal" href="_modules/webnotes/model/import_docs.html#CSVImport.convert_csv_data_into_list"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#webnotes.model.import_docs.CSVImport.convert_csv_data_into_list" title="Permalink to this definition">¶</a></dt>
- <dd></dd></dl>
-
- <dl class="method">
- <dt id="webnotes.model.import_docs.CSVImport.get_field_type_list">
- <tt class="descname">get_field_type_list</tt><big>(</big><big>)</big><a class="reference internal" href="_modules/webnotes/model/import_docs.html#CSVImport.get_field_type_list"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#webnotes.model.import_docs.CSVImport.get_field_type_list" title="Permalink to this definition">¶</a></dt>
- <dd></dd></dl>
-
- <dl class="method">
- <dt id="webnotes.model.import_docs.CSVImport.import_csv">
- <tt class="descname">import_csv</tt><big>(</big><em>csv_data</em>, <em>import_date_format='yyyy-mm-dd'</em>, <em>overwrite=0</em><big>)</big><a class="reference internal" href="_modules/webnotes/model/import_docs.html#CSVImport.import_csv"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#webnotes.model.import_docs.CSVImport.import_csv" title="Permalink to this definition">¶</a></dt>
- <dd></dd></dl>
-
- <dl class="method">
- <dt id="webnotes.model.import_docs.CSVImport.parse_date">
- <tt class="descname">parse_date</tt><big>(</big><em>r</em>, <em>c</em>, <em>d</em><big>)</big><a class="reference internal" href="_modules/webnotes/model/import_docs.html#CSVImport.parse_date"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#webnotes.model.import_docs.CSVImport.parse_date" title="Permalink to this definition">¶</a></dt>
- <dd></dd></dl>
-
- <dl class="method">
- <dt id="webnotes.model.import_docs.CSVImport.update_data">
- <tt class="descname">update_data</tt><big>(</big><em>fd</em>, <em>row</em><big>)</big><a class="reference internal" href="_modules/webnotes/model/import_docs.html#CSVImport.update_data"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#webnotes.model.import_docs.CSVImport.update_data" title="Permalink to this definition">¶</a></dt>
- <dd></dd></dl>
-
- <dl class="method">
- <dt id="webnotes.model.import_docs.CSVImport.validate_data">
- <tt class="descname">validate_data</tt><big>(</big><big>)</big><a class="reference internal" href="_modules/webnotes/model/import_docs.html#CSVImport.validate_data"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#webnotes.model.import_docs.CSVImport.validate_data" title="Permalink to this definition">¶</a></dt>
- <dd></dd></dl>
-
- <dl class="method">
- <dt id="webnotes.model.import_docs.CSVImport.validate_doctype">
- <tt class="descname">validate_doctype</tt><big>(</big><em>dt_list</em><big>)</big><a class="reference internal" href="_modules/webnotes/model/import_docs.html#CSVImport.validate_doctype"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#webnotes.model.import_docs.CSVImport.validate_doctype" title="Permalink to this definition">¶</a></dt>
- <dd></dd></dl>
-
- <dl class="method">
- <dt id="webnotes.model.import_docs.CSVImport.validate_fields">
- <tt class="descname">validate_fields</tt><big>(</big><em>lb_list</em><big>)</big><a class="reference internal" href="_modules/webnotes/model/import_docs.html#CSVImport.validate_fields"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#webnotes.model.import_docs.CSVImport.validate_fields" title="Permalink to this definition">¶</a></dt>
- <dd></dd></dl>
-
- <dl class="method">
- <dt id="webnotes.model.import_docs.CSVImport.validate_headers">
- <tt class="descname">validate_headers</tt><big>(</big><big>)</big><a class="reference internal" href="_modules/webnotes/model/import_docs.html#CSVImport.validate_headers"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#webnotes.model.import_docs.CSVImport.validate_headers" title="Permalink to this definition">¶</a></dt>
- <dd></dd></dl>
-
- </dd></dl>
-
- <dl class="function">
- <dt id="webnotes.model.import_docs.get_template">
- <tt class="descclassname">webnotes.model.import_docs.</tt><tt class="descname">get_template</tt><big>(</big><big>)</big><a class="reference internal" href="_modules/webnotes/model/import_docs.html#get_template"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#webnotes.model.import_docs.get_template" title="Permalink to this definition">¶</a></dt>
- <dd></dd></dl>
-
- <dl class="function">
- <dt id="webnotes.model.import_docs.import_docs">
- <tt class="descclassname">webnotes.model.import_docs.</tt><tt class="descname">import_docs</tt><big>(</big><em>docs=</em><span class="optional">[</span><span class="optional">]</span><big>)</big><a class="reference internal" href="_modules/webnotes/model/import_docs.html#import_docs"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#webnotes.model.import_docs.import_docs" title="Permalink to this definition">¶</a></dt>
- <dd></dd></dl>
-
- </div>
- <div class="section" id="module-webnotes.model.meta">
- <span id="meta-module"></span><h2><tt class="xref py py-mod docutils literal"><span class="pre">meta</span></tt> Module<a class="headerlink" href="#module-webnotes.model.meta" title="Permalink to this headline">¶</a></h2>
- <dl class="function">
- <dt id="webnotes.model.meta.get_dt_values">
- <tt class="descclassname">webnotes.model.meta.</tt><tt class="descname">get_dt_values</tt><big>(</big><em>doctype</em>, <em>fields</em>, <em>as_dict=0</em><big>)</big><a class="reference internal" href="_modules/webnotes/model/meta.html#get_dt_values"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#webnotes.model.meta.get_dt_values" title="Permalink to this definition">¶</a></dt>
- <dd></dd></dl>
-
- <dl class="function">
- <dt id="webnotes.model.meta.get_link_fields">
- <tt class="descclassname">webnotes.model.meta.</tt><tt class="descname">get_link_fields</tt><big>(</big><em>doctype</em><big>)</big><a class="reference internal" href="_modules/webnotes/model/meta.html#get_link_fields"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#webnotes.model.meta.get_link_fields" title="Permalink to this definition">¶</a></dt>
- <dd></dd></dl>
-
- <dl class="function">
- <dt id="webnotes.model.meta.get_parent_dt">
- <tt class="descclassname">webnotes.model.meta.</tt><tt class="descname">get_parent_dt</tt><big>(</big><em>dt</em><big>)</big><a class="reference internal" href="_modules/webnotes/model/meta.html#get_parent_dt"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#webnotes.model.meta.get_parent_dt" title="Permalink to this definition">¶</a></dt>
- <dd></dd></dl>
-
- <dl class="function">
- <dt id="webnotes.model.meta.get_print_format_html">
- <tt class="descclassname">webnotes.model.meta.</tt><tt class="descname">get_print_format_html</tt><big>(</big><em>name</em><big>)</big><a class="reference internal" href="_modules/webnotes/model/meta.html#get_print_format_html"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#webnotes.model.meta.get_print_format_html" title="Permalink to this definition">¶</a></dt>
- <dd></dd></dl>
-
- <dl class="function">
- <dt id="webnotes.model.meta.get_search_criteria">
- <tt class="descclassname">webnotes.model.meta.</tt><tt class="descname">get_search_criteria</tt><big>(</big><em>dt</em><big>)</big><a class="reference internal" href="_modules/webnotes/model/meta.html#get_search_criteria"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#webnotes.model.meta.get_search_criteria" title="Permalink to this definition">¶</a></dt>
- <dd></dd></dl>
-
- <dl class="function">
- <dt id="webnotes.model.meta.get_table_fields">
- <tt class="descclassname">webnotes.model.meta.</tt><tt class="descname">get_table_fields</tt><big>(</big><em>doctype</em><big>)</big><a class="reference internal" href="_modules/webnotes/model/meta.html#get_table_fields"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#webnotes.model.meta.get_table_fields" title="Permalink to this definition">¶</a></dt>
- <dd></dd></dl>
-
- <dl class="function">
- <dt id="webnotes.model.meta.is_single">
- <tt class="descclassname">webnotes.model.meta.</tt><tt class="descname">is_single</tt><big>(</big><em>doctype</em><big>)</big><a class="reference internal" href="_modules/webnotes/model/meta.html#is_single"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#webnotes.model.meta.is_single" title="Permalink to this definition">¶</a></dt>
- <dd></dd></dl>
-
- <dl class="function">
- <dt id="webnotes.model.meta.set_dt_value">
- <tt class="descclassname">webnotes.model.meta.</tt><tt class="descname">set_dt_value</tt><big>(</big><em>doctype</em>, <em>field</em>, <em>value</em><big>)</big><a class="reference internal" href="_modules/webnotes/model/meta.html#set_dt_value"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#webnotes.model.meta.set_dt_value" title="Permalink to this definition">¶</a></dt>
- <dd></dd></dl>
-
- <dl class="function">
- <dt id="webnotes.model.meta.set_fieldname">
- <tt class="descclassname">webnotes.model.meta.</tt><tt class="descname">set_fieldname</tt><big>(</big><em>field_id</em>, <em>fieldname</em><big>)</big><a class="reference internal" href="_modules/webnotes/model/meta.html#set_fieldname"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#webnotes.model.meta.set_fieldname" title="Permalink to this definition">¶</a></dt>
- <dd></dd></dl>
-
- </div>
- <div class="section" id="module-webnotes.model.modules">
- <span id="modules-module"></span><h2><tt class="xref py py-mod docutils literal"><span class="pre">modules</span></tt> Module<a class="headerlink" href="#module-webnotes.model.modules" title="Permalink to this headline">¶</a></h2>
- <dl class="function">
- <dt id="webnotes.model.modules.get_module_items">
- <tt class="descclassname">webnotes.model.modules.</tt><tt class="descname">get_module_items</tt><big>(</big><em>mod</em>, <em>only_dt=0</em><big>)</big><a class="reference internal" href="_modules/webnotes/model/modules.html#get_module_items"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#webnotes.model.modules.get_module_items" title="Permalink to this definition">¶</a></dt>
- <dd></dd></dl>
-
- </div>
- <div class="section" id="module-webnotes.model.triggers">
- <span id="triggers-module"></span><h2><tt class="xref py py-mod docutils literal"><span class="pre">triggers</span></tt> Module<a class="headerlink" href="#module-webnotes.model.triggers" title="Permalink to this headline">¶</a></h2>
- <p>Add, manage, fire triggers (events / observers)
- Standard events called by the framework are “save, submit, cancel”</p>
- <dl class="function">
- <dt id="webnotes.model.triggers.add_trigger">
- <tt class="descclassname">webnotes.model.triggers.</tt><tt class="descname">add_trigger</tt><big>(</big><em>doctype</em>, <em>docname</em>, <em>event_name</em>, <em>method</em><big>)</big><a class="reference internal" href="_modules/webnotes/model/triggers.html#add_trigger"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#webnotes.model.triggers.add_trigger" title="Permalink to this definition">¶</a></dt>
- <dd><p>Add a trigger to an event on a doctype, docname. The specified method will be called.
- Wild card ‘*’ is allowed in doctype, docname and/or event_name</p>
- </dd></dl>
-
- <dl class="function">
- <dt id="webnotes.model.triggers.fire_event">
- <tt class="descclassname">webnotes.model.triggers.</tt><tt class="descname">fire_event</tt><big>(</big><em>doc</em>, <em>event_name</em><big>)</big><a class="reference internal" href="_modules/webnotes/model/triggers.html#fire_event"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#webnotes.model.triggers.fire_event" title="Permalink to this definition">¶</a></dt>
- <dd><p>Fire all triggers on an event and passes the doc to the trigger</p>
- </dd></dl>
-
- <dl class="function">
- <dt id="webnotes.model.triggers.insert_trigger">
- <tt class="descclassname">webnotes.model.triggers.</tt><tt class="descname">insert_trigger</tt><big>(</big><em>doctype</em>, <em>docname</em>, <em>event_name</em>, <em>method</em><big>)</big><a class="reference internal" href="_modules/webnotes/model/triggers.html#insert_trigger"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#webnotes.model.triggers.insert_trigger" title="Permalink to this definition">¶</a></dt>
- <dd><p>inserts a new trigger record</p>
- </dd></dl>
-
- <dl class="function">
- <dt id="webnotes.model.triggers.remove_trigger">
- <tt class="descclassname">webnotes.model.triggers.</tt><tt class="descname">remove_trigger</tt><big>(</big><em>doctype</em>, <em>docname</em>, <em>event_name</em>, <em>method</em><big>)</big><a class="reference internal" href="_modules/webnotes/model/triggers.html#remove_trigger"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#webnotes.model.triggers.remove_trigger" title="Permalink to this definition">¶</a></dt>
- <dd><p>Remove a trigger on an event</p>
- </dd></dl>
-
- <dl class="function">
- <dt id="webnotes.model.triggers.setup">
- <tt class="descclassname">webnotes.model.triggers.</tt><tt class="descname">setup</tt><big>(</big><big>)</big><a class="reference internal" href="_modules/webnotes/model/triggers.html#setup"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#webnotes.model.triggers.setup" title="Permalink to this definition">¶</a></dt>
- <dd><p>creates the DocTrigger table from core</p>
- </dd></dl>
-
- <dl class="function">
- <dt id="webnotes.model.triggers.trigger_exists">
- <tt class="descclassname">webnotes.model.triggers.</tt><tt class="descname">trigger_exists</tt><big>(</big><em>doctype</em>, <em>docname</em>, <em>event_name</em>, <em>method</em><big>)</big><a class="reference internal" href="_modules/webnotes/model/triggers.html#trigger_exists"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#webnotes.model.triggers.trigger_exists" title="Permalink to this definition">¶</a></dt>
- <dd><p>returns true if trigger exists</p>
- </dd></dl>
-
- </div>
- </div>
-
-
- </div>
- </div>
- </div>
- <div class="sphinxsidebar">
- <div class="sphinxsidebarwrapper">
- <p class="logo"><a href="index.html">
- <img class="logo" src="_static/wnflogo200.gif" alt="Logo"/>
- </a></p>
- <h3><a href="index.html">Table Of Contents</a></h3>
- <ul>
- <li><a class="reference internal" href="#">model Package</a><ul>
- <li><a class="reference internal" href="#id1"><tt class="docutils literal"><span class="pre">model</span></tt> Package</a></li>
- <li><a class="reference internal" href="#module-webnotes.model.code"><tt class="docutils literal"><span class="pre">code</span></tt> Module</a></li>
- <li><a class="reference internal" href="#module-webnotes.model.db_schema"><tt class="docutils literal"><span class="pre">db_schema</span></tt> Module</a></li>
- <li><a class="reference internal" href="#module-webnotes.model.doc"><tt class="docutils literal"><span class="pre">doc</span></tt> Module</a></li>
- <li><a class="reference internal" href="#module-webnotes.model.doclist"><tt class="docutils literal"><span class="pre">doclist</span></tt> Module</a></li>
- <li><a class="reference internal" href="#module-webnotes.model.doctype"><tt class="docutils literal"><span class="pre">doctype</span></tt> Module</a><ul>
- <li><a class="reference internal" href="#id2">DocType module</a></li>
- </ul>
- </li>
- <li><a class="reference internal" href="#module-webnotes.model.import_docs"><tt class="docutils literal"><span class="pre">import_docs</span></tt> Module</a></li>
- <li><a class="reference internal" href="#module-webnotes.model.meta"><tt class="docutils literal"><span class="pre">meta</span></tt> Module</a></li>
- <li><a class="reference internal" href="#module-webnotes.model.modules"><tt class="docutils literal"><span class="pre">modules</span></tt> Module</a></li>
- <li><a class="reference internal" href="#module-webnotes.model.triggers"><tt class="docutils literal"><span class="pre">triggers</span></tt> Module</a></li>
- </ul>
- </li>
- </ul>
-
- <h3>This Page</h3>
- <ul class="this-page-menu">
- <li><a href="_sources/webnotes.model.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" size="18" />
- <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>
- <div class="clearer"></div>
- </div>
- <div class="related">
- <h3>Navigation</h3>
- <ul>
- <li class="right" style="margin-right: 10px">
- <a href="genindex.html" title="General Index"
- >index</a></li>
- <li class="right" >
- <a href="py-modindex.html" title="Python Module Index"
- >modules</a> |</li>
- <li><a href="index.html">WNFramework v1.8 documentation</a> »</li>
- </ul>
- </div>
- <div class="footer">
- © Copyright 2011, Rushabh Mehta, Web Notes Technologies.
- Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.7.
- </div>
- </body>
- </html>
|