diff --git a/AUTHORS b/AUTHORS
index ec8eca8e2d..bd7ef7770d 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -85,6 +85,7 @@ answer newbie questions, and generally made Django that much better:
Jeremy Dunck
Andy Dustman
Clint Ecker
+ enlight
Enrico
Ludvig Ericson
Dirk Eschler
diff --git a/django/db/__init__.py b/django/db/__init__.py
index 4176b5aa79..33223d200a 100644
--- a/django/db/__init__.py
+++ b/django/db/__init__.py
@@ -2,7 +2,7 @@ from django.conf import settings
from django.core import signals
from django.dispatch import dispatcher
-__all__ = ('backend', 'connection', 'DatabaseError')
+__all__ = ('backend', 'connection', 'DatabaseError', 'IntegrityError')
if not settings.DATABASE_ENGINE:
settings.DATABASE_ENGINE = 'dummy'
@@ -29,6 +29,7 @@ runshell = lambda: __import__('django.db.backends.%s.client' % settings.DATABASE
connection = backend.DatabaseWrapper(**settings.DATABASE_OPTIONS)
DatabaseError = backend.DatabaseError
+IntegrityError = backend.IntegrityError
# Register an event that closes the database connection
# when a Django request is finished.
diff --git a/django/db/backends/ado_mssql/base.py b/django/db/backends/ado_mssql/base.py
index 1a2f3de140..52363ed705 100644
--- a/django/db/backends/ado_mssql/base.py
+++ b/django/db/backends/ado_mssql/base.py
@@ -17,6 +17,7 @@ except ImportError:
mx = None
DatabaseError = Database.DatabaseError
+IntegrityError = Database.IntegrityError
# We need to use a special Cursor class because adodbapi expects question-mark
# param style, but Django expects "%s". This cursor converts question marks to
diff --git a/django/db/backends/dummy/base.py b/django/db/backends/dummy/base.py
index eb3c3867c2..6a909016fc 100644
--- a/django/db/backends/dummy/base.py
+++ b/django/db/backends/dummy/base.py
@@ -15,6 +15,9 @@ def complain(*args, **kwargs):
class DatabaseError(Exception):
pass
+class IntegrityError(DatabaseError):
+ pass
+
class DatabaseWrapper:
cursor = complain
_commit = complain
diff --git a/django/db/backends/mysql/base.py b/django/db/backends/mysql/base.py
index 3c2431a982..41f4638980 100644
--- a/django/db/backends/mysql/base.py
+++ b/django/db/backends/mysql/base.py
@@ -25,6 +25,7 @@ import types
import re
DatabaseError = Database.DatabaseError
+IntegrityError = Database.IntegrityError
# MySQLdb-1.2.1 supports the Python boolean type, and only uses datetime
# module for time-related columns; older versions could have used mx.DateTime
diff --git a/django/db/backends/mysql_old/base.py b/django/db/backends/mysql_old/base.py
index ded0b6cbcb..01eff22641 100644
--- a/django/db/backends/mysql_old/base.py
+++ b/django/db/backends/mysql_old/base.py
@@ -16,6 +16,7 @@ import types
import re
DatabaseError = Database.DatabaseError
+IntegrityError = Database.IntegrityError
django_conversions = conversions.copy()
django_conversions.update({
diff --git a/django/db/backends/oracle/base.py b/django/db/backends/oracle/base.py
index 0f32407638..2bc88bb7b9 100644
--- a/django/db/backends/oracle/base.py
+++ b/django/db/backends/oracle/base.py
@@ -12,6 +12,7 @@ except ImportError, e:
raise ImproperlyConfigured, "Error loading cx_Oracle module: %s" % e
DatabaseError = Database.Error
+IntegrityError = Database.IntegrityError
try:
# Only exists in Python 2.4+
diff --git a/django/db/backends/postgresql/base.py b/django/db/backends/postgresql/base.py
index b7be7951fc..bb52711191 100644
--- a/django/db/backends/postgresql/base.py
+++ b/django/db/backends/postgresql/base.py
@@ -12,6 +12,7 @@ except ImportError, e:
raise ImproperlyConfigured, "Error loading psycopg module: %s" % e
DatabaseError = Database.DatabaseError
+IntegrityError = Database.IntegrityError
try:
# Only exists in Python 2.4+
diff --git a/django/db/backends/postgresql_psycopg2/base.py b/django/db/backends/postgresql_psycopg2/base.py
index bc722261bb..d6f34f1fe1 100644
--- a/django/db/backends/postgresql_psycopg2/base.py
+++ b/django/db/backends/postgresql_psycopg2/base.py
@@ -12,6 +12,7 @@ except ImportError, e:
raise ImproperlyConfigured, "Error loading psycopg2 module: %s" % e
DatabaseError = Database.DatabaseError
+IntegrityError = Database.IntegrityError
try:
# Only exists in Python 2.4+
diff --git a/django/db/backends/sqlite3/base.py b/django/db/backends/sqlite3/base.py
index ec0f715491..d8e1336a9a 100644
--- a/django/db/backends/sqlite3/base.py
+++ b/django/db/backends/sqlite3/base.py
@@ -18,6 +18,7 @@ except ImportError, e:
raise ImproperlyConfigured, "Error loading %s module: %s" % (module, e)
DatabaseError = Database.DatabaseError
+IntegrityError = Database.IntegrityError
Database.register_converter("bool", lambda s: str(s) == '1')
Database.register_converter("time", util.typecast_time)