Sophie

Sophie

distrib > Mageia > 6 > x86_64 > media > core-updates > by-pkgid > 3f388dbb5c0ba9abe7c510467d6cc65d > files > 753

python-django-doc-1.8.19-1.1.mga6.noarch.rpm

<!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" lang="">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    
    <title>Django Exceptions &#8212; Django 1.8.19 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.19',
        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="index" title="Index" href="../genindex.html" />
    <link rel="search" title="Search" href="../search.html" />
    <link rel="top" title="Django 1.8.19 documentation" href="../contents.html" />
    <link rel="up" title="API Reference" href="index.html" />
    <link rel="next" title="File handling" href="files/index.html" />
    <link rel="prev" title="django-admin and manage.py" href="django-admin.html" />



 
<script type="text/javascript" src="../templatebuiltins.js"></script>
<script type="text/javascript">
(function($) {
    if (!django_template_builtins) {
       // templatebuiltins.js missing, do nothing.
       return;
    }
    $(document).ready(function() {
        // Hyperlink Django template tags and filters
        var base = "templates/builtins.html";
        if (base == "#") {
            // Special case for builtins.html itself
            base = "";
        }
        // Tags are keywords, class '.k'
        $("div.highlight\\-html\\+django span.k").each(function(i, elem) {
             var tagname = $(elem).text();
             if ($.inArray(tagname, django_template_builtins.ttags) != -1) {
                 var fragment = tagname.replace(/_/, '-');
                 $(elem).html("<a href='" + base + "#" + fragment + "'>" + tagname + "</a>");
             }
        });
        // Filters are functions, class '.nf'
        $("div.highlight\\-html\\+django span.nf").each(function(i, elem) {
             var filtername = $(elem).text();
             if ($.inArray(filtername, django_template_builtins.tfilters) != -1) {
                 var fragment = filtername.replace(/_/, '-');
                 $(elem).html("<a href='" + base + "#" + fragment + "'>" + filtername + "</a>");
             }
        });
    });
})(jQuery);
</script>


  </head>
  <body role="document">

    <div class="document">
  <div id="custom-doc" class="yui-t6">
    <div id="hd">
      <h1><a href="../index.html">Django 1.8.19 documentation</a></h1>
      <div id="global-nav">
        <a title="Home page" href="../index.html">Home</a>  |
        <a title="Table of contents" href="../contents.html">Table of contents</a>  |
        <a title="Global index" href="../genindex.html">Index</a>  |
        <a title="Module index" href="../py-modindex.html">Modules</a>
      </div>
      <div class="nav">
    &laquo; <a href="django-admin.html" title="django-admin and manage.py">previous</a>
     |
    <a href="index.html" title="API Reference" accesskey="U">up</a>
   |
    <a href="files/index.html" title="File handling">next</a> &raquo;</div>
    </div>

    <div id="bd">
      <div id="yui-main">
        <div class="yui-b">
          <div class="yui-g" id="ref-exceptions">
            
  <div class="section" id="s-django-exceptions">
<span id="django-exceptions"></span><h1>Django Exceptions<a class="headerlink" href="#django-exceptions" title="Permalink to this headline">¶</a></h1>
<p>Django raises some of its own exceptions as well as standard Python exceptions.</p>
<div class="section" id="s-module-django.core.exceptions">
<span id="s-django-core-exceptions"></span><span id="module-django.core.exceptions"></span><span id="django-core-exceptions"></span><h2>Django Core Exceptions<a class="headerlink" href="#module-django.core.exceptions" title="Permalink to this headline">¶</a></h2>
<p>Django core exception classes are defined in <code class="docutils literal"><span class="pre">django.core.exceptions</span></code>.</p>
<div class="section" id="s-objectdoesnotexist">
<span id="objectdoesnotexist"></span><h3><code class="docutils literal"><span class="pre">ObjectDoesNotExist</span></code><a class="headerlink" href="#objectdoesnotexist" title="Permalink to this headline">¶</a></h3>
<dl class="exception">
<dt id="django.core.exceptions.ObjectDoesNotExist">
<em class="property">exception </em><code class="descname">ObjectDoesNotExist</code><a class="reference internal" href="../_modules/django/core/exceptions.html#ObjectDoesNotExist"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#django.core.exceptions.ObjectDoesNotExist" title="Permalink to this definition">¶</a></dt>
<dd><p>The base class for <a class="reference internal" href="models/instances.html#django.db.models.Model.DoesNotExist" title="django.db.models.Model.DoesNotExist"><code class="xref py py-exc docutils literal"><span class="pre">DoesNotExist</span></code></a> exceptions;
a <code class="docutils literal"><span class="pre">try/except</span></code> for <code class="docutils literal"><span class="pre">ObjectDoesNotExist</span></code> will catch
<a class="reference internal" href="models/instances.html#django.db.models.Model.DoesNotExist" title="django.db.models.Model.DoesNotExist"><code class="xref py py-exc docutils literal"><span class="pre">DoesNotExist</span></code></a> exceptions for all models.</p>
<p>See <a class="reference internal" href="models/querysets.html#django.db.models.query.QuerySet.get" title="django.db.models.query.QuerySet.get"><code class="xref py py-meth docutils literal"><span class="pre">get()</span></code></a> for further information
on <a class="reference internal" href="#django.core.exceptions.ObjectDoesNotExist" title="django.core.exceptions.ObjectDoesNotExist"><code class="xref py py-exc docutils literal"><span class="pre">ObjectDoesNotExist</span></code></a> and <a class="reference internal" href="models/instances.html#django.db.models.Model.DoesNotExist" title="django.db.models.Model.DoesNotExist"><code class="xref py py-exc docutils literal"><span class="pre">DoesNotExist</span></code></a>.</p>
</dd></dl>

</div>
<div class="section" id="s-fielddoesnotexist">
<span id="fielddoesnotexist"></span><h3><code class="docutils literal"><span class="pre">FieldDoesNotExist</span></code><a class="headerlink" href="#fielddoesnotexist" title="Permalink to this headline">¶</a></h3>
<dl class="exception">
<dt id="django.core.exceptions.FieldDoesNotExist">
<em class="property">exception </em><code class="descname">FieldDoesNotExist</code><a class="reference internal" href="../_modules/django/core/exceptions.html#FieldDoesNotExist"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#django.core.exceptions.FieldDoesNotExist" title="Permalink to this definition">¶</a></dt>
<dd><p>The <code class="docutils literal"><span class="pre">FieldDoesNotExist</span></code> exception is raised by a model&#8217;s
<code class="docutils literal"><span class="pre">_meta.get_field()</span></code> method when the requested field does not exist on the
model or on the model&#8217;s parents.</p>
<div class="versionchanged">
<span class="title">Changed in Django 1.8:</span> <p>This exception was previously defined only in
<code class="docutils literal"><span class="pre">django.db.models.fields</span></code> and wasn&#8217;t part of the public API.</p>
</div>
</dd></dl>

</div>
<div class="section" id="s-multipleobjectsreturned">
<span id="multipleobjectsreturned"></span><h3><code class="docutils literal"><span class="pre">MultipleObjectsReturned</span></code><a class="headerlink" href="#multipleobjectsreturned" title="Permalink to this headline">¶</a></h3>
<dl class="exception">
<dt id="django.core.exceptions.MultipleObjectsReturned">
<em class="property">exception </em><code class="descname">MultipleObjectsReturned</code><a class="reference internal" href="../_modules/django/core/exceptions.html#MultipleObjectsReturned"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#django.core.exceptions.MultipleObjectsReturned" title="Permalink to this definition">¶</a></dt>
<dd><p>The <a class="reference internal" href="#django.core.exceptions.MultipleObjectsReturned" title="django.core.exceptions.MultipleObjectsReturned"><code class="xref py py-exc docutils literal"><span class="pre">MultipleObjectsReturned</span></code></a> exception is raised by a query if only
one object is expected, but multiple objects are returned. A base version
of this exception is provided in <a class="reference internal" href="#module-django.core.exceptions" title="django.core.exceptions: Django core exceptions"><code class="xref py py-mod docutils literal"><span class="pre">django.core.exceptions</span></code></a>; each model
class contains a subclassed version that can be used to identify the
specific object type that has returned multiple objects.</p>
<p>See <a class="reference internal" href="models/querysets.html#django.db.models.query.QuerySet.get" title="django.db.models.query.QuerySet.get"><code class="xref py py-meth docutils literal"><span class="pre">get()</span></code></a> for further information.</p>
</dd></dl>

</div>
<div class="section" id="s-suspiciousoperation">
<span id="suspiciousoperation"></span><h3><code class="docutils literal"><span class="pre">SuspiciousOperation</span></code><a class="headerlink" href="#suspiciousoperation" title="Permalink to this headline">¶</a></h3>
<dl class="exception">
<dt id="django.core.exceptions.SuspiciousOperation">
<em class="property">exception </em><code class="descname">SuspiciousOperation</code><a class="reference internal" href="../_modules/django/core/exceptions.html#SuspiciousOperation"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#django.core.exceptions.SuspiciousOperation" title="Permalink to this definition">¶</a></dt>
<dd><p>The <a class="reference internal" href="#django.core.exceptions.SuspiciousOperation" title="django.core.exceptions.SuspiciousOperation"><code class="xref py py-exc docutils literal"><span class="pre">SuspiciousOperation</span></code></a> exception is raised when a user has
performed an operation that should be considered suspicious from a security
perspective, such as tampering with a session cookie. Subclasses of
<code class="docutils literal"><span class="pre">SuspiciousOperation</span></code> include:</p>
<ul class="simple">
<li><code class="docutils literal"><span class="pre">DisallowedHost</span></code></li>
<li><code class="docutils literal"><span class="pre">DisallowedModelAdminLookup</span></code></li>
<li><code class="docutils literal"><span class="pre">DisallowedModelAdminToField</span></code></li>
<li><code class="docutils literal"><span class="pre">DisallowedRedirect</span></code></li>
<li><code class="docutils literal"><span class="pre">InvalidSessionKey</span></code></li>
<li><code class="docutils literal"><span class="pre">SuspiciousFileOperation</span></code></li>
<li><code class="docutils literal"><span class="pre">SuspiciousMultipartForm</span></code></li>
<li><code class="docutils literal"><span class="pre">SuspiciousSession</span></code></li>
</ul>
<p>If a <code class="docutils literal"><span class="pre">SuspiciousOperation</span></code> exception reaches the WSGI handler level it is
logged at the <code class="docutils literal"><span class="pre">Error</span></code> level and results in
a <a class="reference internal" href="request-response.html#django.http.HttpResponseBadRequest" title="django.http.HttpResponseBadRequest"><code class="xref py py-class docutils literal"><span class="pre">HttpResponseBadRequest</span></code></a>. See the <a class="reference internal" href="../topics/logging.html"><span class="doc">logging
documentation</span></a> for more information.</p>
</dd></dl>

</div>
<div class="section" id="s-permissiondenied">
<span id="permissiondenied"></span><h3><code class="docutils literal"><span class="pre">PermissionDenied</span></code><a class="headerlink" href="#permissiondenied" title="Permalink to this headline">¶</a></h3>
<dl class="exception">
<dt id="django.core.exceptions.PermissionDenied">
<em class="property">exception </em><code class="descname">PermissionDenied</code><a class="reference internal" href="../_modules/django/core/exceptions.html#PermissionDenied"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#django.core.exceptions.PermissionDenied" title="Permalink to this definition">¶</a></dt>
<dd><p>The <a class="reference internal" href="#django.core.exceptions.PermissionDenied" title="django.core.exceptions.PermissionDenied"><code class="xref py py-exc docutils literal"><span class="pre">PermissionDenied</span></code></a> exception is raised when a user does not have
permission to perform the action requested.</p>
</dd></dl>

</div>
<div class="section" id="s-viewdoesnotexist">
<span id="viewdoesnotexist"></span><h3><code class="docutils literal"><span class="pre">ViewDoesNotExist</span></code><a class="headerlink" href="#viewdoesnotexist" title="Permalink to this headline">¶</a></h3>
<dl class="exception">
<dt id="django.core.exceptions.ViewDoesNotExist">
<em class="property">exception </em><code class="descname">ViewDoesNotExist</code><a class="reference internal" href="../_modules/django/core/exceptions.html#ViewDoesNotExist"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#django.core.exceptions.ViewDoesNotExist" title="Permalink to this definition">¶</a></dt>
<dd><p>The <a class="reference internal" href="#django.core.exceptions.ViewDoesNotExist" title="django.core.exceptions.ViewDoesNotExist"><code class="xref py py-exc docutils literal"><span class="pre">ViewDoesNotExist</span></code></a> exception is raised by
<a class="reference internal" href="urlresolvers.html#module-django.core.urlresolvers" title="django.core.urlresolvers"><code class="xref py py-mod docutils literal"><span class="pre">django.core.urlresolvers</span></code></a> when a requested view does not exist.</p>
</dd></dl>

</div>
<div class="section" id="s-middlewarenotused">
<span id="middlewarenotused"></span><h3><code class="docutils literal"><span class="pre">MiddlewareNotUsed</span></code><a class="headerlink" href="#middlewarenotused" title="Permalink to this headline">¶</a></h3>
<dl class="exception">
<dt id="django.core.exceptions.MiddlewareNotUsed">
<em class="property">exception </em><code class="descname">MiddlewareNotUsed</code><a class="reference internal" href="../_modules/django/core/exceptions.html#MiddlewareNotUsed"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#django.core.exceptions.MiddlewareNotUsed" title="Permalink to this definition">¶</a></dt>
<dd><p>The <a class="reference internal" href="#django.core.exceptions.MiddlewareNotUsed" title="django.core.exceptions.MiddlewareNotUsed"><code class="xref py py-exc docutils literal"><span class="pre">MiddlewareNotUsed</span></code></a> exception is raised when a middleware is not
used in the server configuration.</p>
</dd></dl>

</div>
<div class="section" id="s-improperlyconfigured">
<span id="improperlyconfigured"></span><h3><code class="docutils literal"><span class="pre">ImproperlyConfigured</span></code><a class="headerlink" href="#improperlyconfigured" title="Permalink to this headline">¶</a></h3>
<dl class="exception">
<dt id="django.core.exceptions.ImproperlyConfigured">
<em class="property">exception </em><code class="descname">ImproperlyConfigured</code><a class="reference internal" href="../_modules/django/core/exceptions.html#ImproperlyConfigured"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#django.core.exceptions.ImproperlyConfigured" title="Permalink to this definition">¶</a></dt>
<dd><p>The <a class="reference internal" href="#django.core.exceptions.ImproperlyConfigured" title="django.core.exceptions.ImproperlyConfigured"><code class="xref py py-exc docutils literal"><span class="pre">ImproperlyConfigured</span></code></a> exception is raised when Django is
somehow improperly configured &#8211; for example, if a value in <code class="docutils literal"><span class="pre">settings.py</span></code>
is incorrect or unparseable.</p>
</dd></dl>

</div>
<div class="section" id="s-fielderror">
<span id="fielderror"></span><h3><code class="docutils literal"><span class="pre">FieldError</span></code><a class="headerlink" href="#fielderror" title="Permalink to this headline">¶</a></h3>
<dl class="exception">
<dt id="django.core.exceptions.FieldError">
<em class="property">exception </em><code class="descname">FieldError</code><a class="reference internal" href="../_modules/django/core/exceptions.html#FieldError"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#django.core.exceptions.FieldError" title="Permalink to this definition">¶</a></dt>
<dd><p>The <a class="reference internal" href="#django.core.exceptions.FieldError" title="django.core.exceptions.FieldError"><code class="xref py py-exc docutils literal"><span class="pre">FieldError</span></code></a> exception is raised when there is a problem with a
model field. This can happen for several reasons:</p>
<ul class="simple">
<li>A field in a model clashes with a field of the same name from an
abstract base class</li>
<li>An infinite loop is caused by ordering</li>
<li>A keyword cannot be parsed from the filter parameters</li>
<li>A field cannot be determined from a keyword in the query
parameters</li>
<li>A join is not permitted on the specified field</li>
<li>A field name is invalid</li>
<li>A query contains invalid order_by arguments</li>
</ul>
</dd></dl>

</div>
<div class="section" id="s-validationerror">
<span id="validationerror"></span><h3><code class="docutils literal"><span class="pre">ValidationError</span></code><a class="headerlink" href="#validationerror" title="Permalink to this headline">¶</a></h3>
<dl class="exception">
<dt id="django.core.exceptions.ValidationError">
<em class="property">exception </em><code class="descname">ValidationError</code><a class="reference internal" href="../_modules/django/core/exceptions.html#ValidationError"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#django.core.exceptions.ValidationError" title="Permalink to this definition">¶</a></dt>
<dd><p>The <a class="reference internal" href="#django.core.exceptions.ValidationError" title="django.core.exceptions.ValidationError"><code class="xref py py-exc docutils literal"><span class="pre">ValidationError</span></code></a> exception is raised when data fails form or
model field validation. For more information about validation, see
<a class="reference internal" href="forms/validation.html"><span class="doc">Form and Field Validation</span></a>,
<a class="reference internal" href="models/instances.html#validating-objects"><span class="std std-ref">Model Field Validation</span></a> and the
<a class="reference internal" href="validators.html"><span class="doc">Validator Reference</span></a>.</p>
</dd></dl>

<div class="section" id="s-non-field-errors">
<span id="non-field-errors"></span><h4><code class="docutils literal"><span class="pre">NON_FIELD_ERRORS</span></code><a class="headerlink" href="#non-field-errors" title="Permalink to this headline">¶</a></h4>
<dl class="data">
<dt id="django.core.exceptions.NON_FIELD_ERRORS">
<code class="descname">NON_FIELD_ERRORS</code><a class="headerlink" href="#django.core.exceptions.NON_FIELD_ERRORS" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<p><code class="docutils literal"><span class="pre">ValidationError</span></code>s that don&#8217;t belong to a particular field in a form
or model are classified as <code class="docutils literal"><span class="pre">NON_FIELD_ERRORS</span></code>. This constant is used
as a key in dictionaries that otherwise map fields to their respective
list of errors.</p>
</div>
</div>
</div>
<div class="section" id="s-url-resolver-exceptions">
<span id="url-resolver-exceptions"></span><h2>URL Resolver exceptions<a class="headerlink" href="#url-resolver-exceptions" title="Permalink to this headline">¶</a></h2>
<p>URL Resolver exceptions are defined in <code class="docutils literal"><span class="pre">django.core.urlresolvers</span></code>.</p>
<div class="section" id="s-resolver404">
<span id="resolver404"></span><h3><code class="docutils literal"><span class="pre">Resolver404</span></code><a class="headerlink" href="#resolver404" title="Permalink to this headline">¶</a></h3>
<dl class="exception">
<dt id="django.core.urlresolvers.Resolver404">
<em class="property">exception </em><code class="descname">Resolver404</code><a class="reference internal" href="../_modules/django/core/urlresolvers.html#Resolver404"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#django.core.urlresolvers.Resolver404" title="Permalink to this definition">¶</a></dt>
<dd><p>The <a class="reference internal" href="#django.core.urlresolvers.Resolver404" title="django.core.urlresolvers.Resolver404"><code class="xref py py-exc docutils literal"><span class="pre">Resolver404</span></code></a> exception is raised by
<a class="reference internal" href="urlresolvers.html#django.core.urlresolvers.resolve" title="django.core.urlresolvers.resolve"><code class="xref py py-func docutils literal"><span class="pre">django.core.urlresolvers.resolve()</span></code></a> if the path passed to
<code class="docutils literal"><span class="pre">resolve()</span></code> doesn&#8217;t map to a view. It&#8217;s a subclass of
<a class="reference internal" href="../topics/http/views.html#django.http.Http404" title="django.http.Http404"><code class="xref py py-class docutils literal"><span class="pre">django.http.Http404</span></code></a>.</p>
</dd></dl>

</div>
<div class="section" id="s-noreversematch">
<span id="noreversematch"></span><h3><code class="docutils literal"><span class="pre">NoReverseMatch</span></code><a class="headerlink" href="#noreversematch" title="Permalink to this headline">¶</a></h3>
<dl class="exception">
<dt id="django.core.urlresolvers.NoReverseMatch">
<em class="property">exception </em><code class="descname">NoReverseMatch</code><a class="reference internal" href="../_modules/django/core/urlresolvers.html#NoReverseMatch"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#django.core.urlresolvers.NoReverseMatch" title="Permalink to this definition">¶</a></dt>
<dd><p>The <a class="reference internal" href="#django.core.urlresolvers.NoReverseMatch" title="django.core.urlresolvers.NoReverseMatch"><code class="xref py py-exc docutils literal"><span class="pre">NoReverseMatch</span></code></a> exception is raised by
<a class="reference internal" href="urlresolvers.html#module-django.core.urlresolvers" title="django.core.urlresolvers"><code class="xref py py-mod docutils literal"><span class="pre">django.core.urlresolvers</span></code></a> when a matching URL in your URLconf
cannot be identified based on the parameters supplied.</p>
</dd></dl>

</div>
</div>
<div class="section" id="s-database-exceptions">
<span id="database-exceptions"></span><h2>Database Exceptions<a class="headerlink" href="#database-exceptions" title="Permalink to this headline">¶</a></h2>
<p>Database exceptions may be imported from <code class="docutils literal"><span class="pre">django.db</span></code>.</p>
<p>Django wraps the standard database exceptions so that your Django code has a
guaranteed common implementation of these classes.</p>
<dl class="exception">
<dt id="django.db.Error">
<em class="property">exception </em><code class="descname">Error</code><a class="reference internal" href="../_modules/django/db/utils.html#Error"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#django.db.Error" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="exception">
<dt id="django.db.InterfaceError">
<em class="property">exception </em><code class="descname">InterfaceError</code><a class="reference internal" href="../_modules/django/db/utils.html#InterfaceError"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#django.db.InterfaceError" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="exception">
<dt id="django.db.DatabaseError">
<em class="property">exception </em><code class="descname">DatabaseError</code><a class="reference internal" href="../_modules/django/db/utils.html#DatabaseError"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#django.db.DatabaseError" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="exception">
<dt id="django.db.DataError">
<em class="property">exception </em><code class="descname">DataError</code><a class="reference internal" href="../_modules/django/db/utils.html#DataError"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#django.db.DataError" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="exception">
<dt id="django.db.OperationalError">
<em class="property">exception </em><code class="descname">OperationalError</code><a class="reference internal" href="../_modules/django/db/utils.html#OperationalError"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#django.db.OperationalError" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="exception">
<dt id="django.db.IntegrityError">
<em class="property">exception </em><code class="descname">IntegrityError</code><a class="reference internal" href="../_modules/django/db/utils.html#IntegrityError"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#django.db.IntegrityError" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="exception">
<dt id="django.db.InternalError">
<em class="property">exception </em><code class="descname">InternalError</code><a class="reference internal" href="../_modules/django/db/utils.html#InternalError"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#django.db.InternalError" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="exception">
<dt id="django.db.ProgrammingError">
<em class="property">exception </em><code class="descname">ProgrammingError</code><a class="reference internal" href="../_modules/django/db/utils.html#ProgrammingError"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#django.db.ProgrammingError" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="exception">
<dt id="django.db.NotSupportedError">
<em class="property">exception </em><code class="descname">NotSupportedError</code><a class="reference internal" href="../_modules/django/db/utils.html#NotSupportedError"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#django.db.NotSupportedError" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<p>The Django wrappers for database exceptions behave exactly the same as
the underlying database exceptions. See <span class="target" id="index-0"></span><a class="pep reference external" href="https://www.python.org/dev/peps/pep-0249"><strong>PEP 249</strong></a>, the Python Database API
Specification v2.0, for further information.</p>
<p>As per <span class="target" id="index-1"></span><a class="pep reference external" href="https://www.python.org/dev/peps/pep-3134"><strong>PEP 3134</strong></a>, a <code class="docutils literal"><span class="pre">__cause__</span></code> attribute is set with the original
(underlying) database exception, allowing access to any additional
information provided. (Note that this attribute is available under
both Python 2 and Python 3, although <span class="target" id="index-2"></span><a class="pep reference external" href="https://www.python.org/dev/peps/pep-3134"><strong>PEP 3134</strong></a> normally only applies
to Python 3.)</p>
<dl class="exception">
<dt id="django.db.models.ProtectedError">
<em class="property">exception </em><code class="descclassname">models.</code><code class="descname">ProtectedError</code><a class="headerlink" href="#django.db.models.ProtectedError" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<p>Raised to prevent deletion of referenced objects when using
<a class="reference internal" href="models/fields.html#django.db.models.PROTECT" title="django.db.models.PROTECT"><code class="xref py py-attr docutils literal"><span class="pre">django.db.models.PROTECT</span></code></a>. <a class="reference internal" href="#django.db.models.ProtectedError" title="django.db.models.ProtectedError"><code class="xref py py-exc docutils literal"><span class="pre">models.ProtectedError</span></code></a> is a subclass
of <a class="reference internal" href="#django.db.IntegrityError" title="django.db.IntegrityError"><code class="xref py py-exc docutils literal"><span class="pre">IntegrityError</span></code></a>.</p>
</div>
<div class="section" id="s-http-exceptions">
<span id="http-exceptions"></span><h2>Http Exceptions<a class="headerlink" href="#http-exceptions" title="Permalink to this headline">¶</a></h2>
<p>Http exceptions may be imported from <code class="docutils literal"><span class="pre">django.http</span></code>.</p>
<div class="section" id="s-unreadableposterror">
<span id="unreadableposterror"></span><h3><code class="docutils literal"><span class="pre">UnreadablePostError</span></code><a class="headerlink" href="#unreadableposterror" title="Permalink to this headline">¶</a></h3>
<dl class="exception">
<dt id="django.http.UnreadablePostError">
<em class="property">exception </em><code class="descname">UnreadablePostError</code><a class="reference internal" href="../_modules/django/http/request.html#UnreadablePostError"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#django.http.UnreadablePostError" title="Permalink to this definition">¶</a></dt>
<dd><p><a class="reference internal" href="#django.http.UnreadablePostError" title="django.http.UnreadablePostError"><code class="xref py py-exc docutils literal"><span class="pre">UnreadablePostError</span></code></a> is raised when a user cancels an upload.</p>
</dd></dl>

</div>
</div>
<div class="section" id="s-transaction-exceptions">
<span id="transaction-exceptions"></span><h2>Transaction Exceptions<a class="headerlink" href="#transaction-exceptions" title="Permalink to this headline">¶</a></h2>
<p>Transaction exceptions are defined in <code class="docutils literal"><span class="pre">django.db.transaction</span></code>.</p>
<div class="section" id="s-transactionmanagementerror">
<span id="transactionmanagementerror"></span><h3><code class="docutils literal"><span class="pre">TransactionManagementError</span></code><a class="headerlink" href="#transactionmanagementerror" title="Permalink to this headline">¶</a></h3>
<dl class="exception">
<dt id="django.db.transaction.TransactionManagementError">
<em class="property">exception </em><code class="descname">TransactionManagementError</code><a class="reference internal" href="../_modules/django/db/transaction.html#TransactionManagementError"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#django.db.transaction.TransactionManagementError" title="Permalink to this definition">¶</a></dt>
<dd><p><a class="reference internal" href="#django.db.transaction.TransactionManagementError" title="django.db.transaction.TransactionManagementError"><code class="xref py py-exc docutils literal"><span class="pre">TransactionManagementError</span></code></a> is raised for any and all problems
related to database transactions.</p>
</dd></dl>

</div>
</div>
<div class="section" id="s-testing-framework-exceptions">
<span id="testing-framework-exceptions"></span><h2>Testing Framework Exceptions<a class="headerlink" href="#testing-framework-exceptions" title="Permalink to this headline">¶</a></h2>
<p>Exceptions provided by the <code class="docutils literal"><span class="pre">django.test</span></code> package.</p>
<div class="section" id="s-redirectcycleerror">
<span id="redirectcycleerror"></span><h3><code class="docutils literal"><span class="pre">RedirectCycleError</span></code><a class="headerlink" href="#redirectcycleerror" title="Permalink to this headline">¶</a></h3>
<dl class="exception">
<dt id="django.test.client.RedirectCycleError">
<em class="property">exception </em><code class="descclassname">client.</code><code class="descname">RedirectCycleError</code><a class="headerlink" href="#django.test.client.RedirectCycleError" title="Permalink to this definition">¶</a></dt>
<dd><div class="versionadded">
<span class="title">New in Django 1.8.</span> </div>
<p><a class="reference internal" href="#django.test.client.RedirectCycleError" title="django.test.client.RedirectCycleError"><code class="xref py py-exc docutils literal"><span class="pre">RedirectCycleError</span></code></a> is raised when the test client detects a
loop or an overly long chain of redirects.</p>
</dd></dl>

</div>
</div>
<div class="section" id="s-python-exceptions">
<span id="python-exceptions"></span><h2>Python Exceptions<a class="headerlink" href="#python-exceptions" title="Permalink to this headline">¶</a></h2>
<p>Django raises built-in Python exceptions when appropriate as well. See the
Python documentation for further information on the <span class="xref std std-ref">bltin-exceptions</span>.</p>
</div>
</div>


          </div>
        </div>
      </div>
      
        
          <div class="yui-b" id="sidebar">
            
      <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
        <div class="sphinxsidebarwrapper">
  <h3><a href="../contents.html">Table Of Contents</a></h3>
  <ul>
<li><a class="reference internal" href="#">Django Exceptions</a><ul>
<li><a class="reference internal" href="#module-django.core.exceptions">Django Core Exceptions</a><ul>
<li><a class="reference internal" href="#objectdoesnotexist"><code class="docutils literal"><span class="pre">ObjectDoesNotExist</span></code></a></li>
<li><a class="reference internal" href="#fielddoesnotexist"><code class="docutils literal"><span class="pre">FieldDoesNotExist</span></code></a></li>
<li><a class="reference internal" href="#multipleobjectsreturned"><code class="docutils literal"><span class="pre">MultipleObjectsReturned</span></code></a></li>
<li><a class="reference internal" href="#suspiciousoperation"><code class="docutils literal"><span class="pre">SuspiciousOperation</span></code></a></li>
<li><a class="reference internal" href="#permissiondenied"><code class="docutils literal"><span class="pre">PermissionDenied</span></code></a></li>
<li><a class="reference internal" href="#viewdoesnotexist"><code class="docutils literal"><span class="pre">ViewDoesNotExist</span></code></a></li>
<li><a class="reference internal" href="#middlewarenotused"><code class="docutils literal"><span class="pre">MiddlewareNotUsed</span></code></a></li>
<li><a class="reference internal" href="#improperlyconfigured"><code class="docutils literal"><span class="pre">ImproperlyConfigured</span></code></a></li>
<li><a class="reference internal" href="#fielderror"><code class="docutils literal"><span class="pre">FieldError</span></code></a></li>
<li><a class="reference internal" href="#validationerror"><code class="docutils literal"><span class="pre">ValidationError</span></code></a><ul>
<li><a class="reference internal" href="#non-field-errors"><code class="docutils literal"><span class="pre">NON_FIELD_ERRORS</span></code></a></li>
</ul>
</li>
</ul>
</li>
<li><a class="reference internal" href="#url-resolver-exceptions">URL Resolver exceptions</a><ul>
<li><a class="reference internal" href="#resolver404"><code class="docutils literal"><span class="pre">Resolver404</span></code></a></li>
<li><a class="reference internal" href="#noreversematch"><code class="docutils literal"><span class="pre">NoReverseMatch</span></code></a></li>
</ul>
</li>
<li><a class="reference internal" href="#database-exceptions">Database Exceptions</a></li>
<li><a class="reference internal" href="#http-exceptions">Http Exceptions</a><ul>
<li><a class="reference internal" href="#unreadableposterror"><code class="docutils literal"><span class="pre">UnreadablePostError</span></code></a></li>
</ul>
</li>
<li><a class="reference internal" href="#transaction-exceptions">Transaction Exceptions</a><ul>
<li><a class="reference internal" href="#transactionmanagementerror"><code class="docutils literal"><span class="pre">TransactionManagementError</span></code></a></li>
</ul>
</li>
<li><a class="reference internal" href="#testing-framework-exceptions">Testing Framework Exceptions</a><ul>
<li><a class="reference internal" href="#redirectcycleerror"><code class="docutils literal"><span class="pre">RedirectCycleError</span></code></a></li>
</ul>
</li>
<li><a class="reference internal" href="#python-exceptions">Python Exceptions</a></li>
</ul>
</li>
</ul>

  <h3>Browse</h3>
  <ul>
    
      <li>Prev: <a href="django-admin.html">django-admin and manage.py</a></li>
    
    
      <li>Next: <a href="files/index.html">File handling</a></li>
    
  </ul>
  <h3>You are here:</h3>
  <ul>
      <li>
        <a href="../index.html">Django 1.8.19 documentation</a>
        
          <ul><li><a href="index.html">API Reference</a>
        
        <ul><li>Django Exceptions</li></ul>
        </li></ul>
      </li>
  </ul>

  <div role="note" aria-label="source link">
    <h3>This Page</h3>
    <ul class="this-page-menu">
      <li><a href="../_sources/ref/exceptions.txt"
            rel="nofollow">Show Source</a></li>
    </ul>
   </div>
<div id="searchbox" style="display: none" role="search">
  <h3>Quick search</h3>
    <form class="search" action="../search.html" method="get">
      <div><input type="text" name="q" /></div>
      <div><input type="submit" value="Go" /></div>
      <input type="hidden" name="check_keywords" value="yes" />
      <input type="hidden" name="area" value="default" />
    </form>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
        </div>
      </div>
              <h3>Last update:</h3>
              <p class="topless">Jan 06, 2019</p>
          </div>
        
      
    </div>

    <div id="ft">
      <div class="nav">
    &laquo; <a href="django-admin.html" title="django-admin and manage.py">previous</a>
     |
    <a href="index.html" title="API Reference" accesskey="U">up</a>
   |
    <a href="files/index.html" title="File handling">next</a> &raquo;</div>
    </div>
  </div>

      <div class="clearer"></div>
    </div>
  </body>
</html>