Index: docs/topics/forms/modelforms.txt
===================================================================
--- docs/topics/forms/modelforms.txt	(revision 15481)
+++ docs/topics/forms/modelforms.txt	(working copy)
@@ -49,6 +49,8 @@
     Model field                      Form field
     ===============================  ========================================
     ``AutoField``                    Not represented in the form
+    
+    ``BigAutoField``                 Not represented in the form
 
     ``BigIntegerField``              ``IntegerField`` with ``min_value`` set
                                      to -9223372036854775808 and ``max_value``
Index: docs/ref/models/fields.txt
===================================================================
--- docs/ref/models/fields.txt	(revision 15481)
+++ docs/ref/models/fields.txt	(working copy)
@@ -320,6 +320,20 @@
 primary key field will automatically be added to your model if you don't specify
 otherwise. See :ref:`automatic-primary-key-fields`.
 
+``BigAutoField``
+----------------
+
+.. versionadded:: trunk
+
+.. class:: BigAutoField(**options)
+
+Behaves the same as :class:`AutoField` except it uses a :class:`BigIntegerField`
+integer as the field. Use this field if you require a larger number of IDs than
+:class:`AutoField` allows.
+
+You may only have one instance of :class:`AutoField` or :class:`BigAutoField`
+in your model.
+
 ``BigIntegerField``
 -------------------
 
Index: django/db/models/fields/__init__.py
===================================================================
--- django/db/models/fields/__init__.py	(revision 15481)
+++ django/db/models/fields/__init__.py	(working copy)
@@ -487,6 +487,12 @@
     def formfield(self, **kwargs):
         return None
 
+class BigAutoField(AutoField):
+    description = _("Big (8 byte) integer")
+    
+    def get_internal_type(self):
+        return "BigAutoField"
+
 class BooleanField(Field):
     empty_strings_allowed = False
     default_error_messages = {
Index: django/db/models/fields/related.py
===================================================================
--- django/db/models/fields/related.py	(revision 15481)
+++ django/db/models/fields/related.py	(working copy)
@@ -2,8 +2,9 @@
 from django.db import connection, router, transaction
 from django.db.backends import util
 from django.db.models import signals, get_model
-from django.db.models.fields import (AutoField, Field, IntegerField,
-    PositiveIntegerField, PositiveSmallIntegerField, FieldDoesNotExist)
+from django.db.models.fields import (AutoField, BigAutoField, Field,
+    BigIntegerField, IntegerField, PositiveIntegerField, 
+    PositiveSmallIntegerField, FieldDoesNotExist)
 from django.db.models.related import RelatedObject
 from django.db.models.query import QuerySet
 from django.db.models.query_utils import QueryWrapper
@@ -919,11 +920,16 @@
     def db_type(self, connection):
         # The database column type of a ForeignKey is the column type
         # of the field to which it points. An exception is if the ForeignKey
-        # points to an AutoField/PositiveIntegerField/PositiveSmallIntegerField,
-        # in which case the column type is simply that of an IntegerField.
+        # points to an AutoField/BigAutoField/PositiveIntegerField/
+        # PositiveSmallIntegerField,
+        # in which case the column type is simply that of an IntegerField
+        # (or BigIntegerField in the case of BigAutoField).
         # If the database needs similar types for key fields however, the only
-        # thing we can do is making AutoField an IntegerField.
+        # thing we can do is to make AutoField an IntegerField
+        # or BigAutoField a BigIntegerField
         rel_field = self.rel.get_related_field()
+        if isinstance(rel_field, BigAutoField):
+            return BigIntegerField().db_type(connection=connection)
         if (isinstance(rel_field, AutoField) or
                 (not connection.features.related_fields_match_type and
                 isinstance(rel_field, (PositiveIntegerField,
Index: django/db/backends/postgresql/creation.py
===================================================================
--- django/db/backends/postgresql/creation.py	(revision 15481)
+++ django/db/backends/postgresql/creation.py	(working copy)
@@ -8,6 +8,7 @@
     # If a column type is set to None, it won't be included in the output.
     data_types = {
         'AutoField':         'serial',
+        'BigAutoField':      'bigserial',
         'BooleanField':      'boolean',
         'CharField':         'varchar(%(max_length)s)',
         'CommaSeparatedIntegerField': 'varchar(%(max_length)s)',
Index: django/db/backends/sqlite3/base.py
===================================================================
--- django/db/backends/sqlite3/base.py	(revision 15481)
+++ django/db/backends/sqlite3/base.py	(working copy)
@@ -149,7 +149,7 @@
         internal_type = field.get_internal_type()
         if internal_type == 'DecimalField':
             return util.typecast_decimal(field.format_number(value))
-        elif internal_type and internal_type.endswith('IntegerField') or internal_type == 'AutoField':
+        elif internal_type and internal_type.endswith('IntegerField') or internal_type.endswith('AutoField'):
             return int(value)
         elif internal_type == 'DateField':
             return util.typecast_date(value)
Index: django/db/backends/sqlite3/creation.py
===================================================================
--- django/db/backends/sqlite3/creation.py	(revision 15481)
+++ django/db/backends/sqlite3/creation.py	(working copy)
@@ -8,6 +8,7 @@
     # schema inspection is more useful.
     data_types = {
         'AutoField':                    'integer',
+        'BigAutoField':                 'bigint',
         'BooleanField':                 'bool',
         'CharField':                    'varchar(%(max_length)s)',
         'CommaSeparatedIntegerField':   'varchar(%(max_length)s)',
Index: django/db/backends/mysql/creation.py
===================================================================
--- django/db/backends/mysql/creation.py	(revision 15481)
+++ django/db/backends/mysql/creation.py	(working copy)
@@ -7,6 +7,7 @@
     # If a column type is set to None, it won't be included in the output.
     data_types = {
         'AutoField':         'integer AUTO_INCREMENT',
+        'BigAutoField':      'bigint AUTO_INCREMENT',
         'BooleanField':      'bool',
         'CharField':         'varchar(%(max_length)s)',
         'CommaSeparatedIntegerField': 'varchar(%(max_length)s)',
Index: django/db/backends/oracle/creation.py
===================================================================
--- django/db/backends/oracle/creation.py	(revision 15481)
+++ django/db/backends/oracle/creation.py	(working copy)
@@ -15,6 +15,7 @@
 
     data_types = {
         'AutoField':                    'NUMBER(11)',
+        'BigAutoField':                 'NUMBER(19)',
         'BooleanField':                 'NUMBER(1) CHECK (%(qn_column)s IN (0,1))',
         'CharField':                    'NVARCHAR2(%(max_length)s)',
         'CommaSeparatedIntegerField':   'VARCHAR2(%(max_length)s)',
Index: django/db/backends/__init__.py
===================================================================
--- django/db/backends/__init__.py	(revision 15481)
+++ django/db/backends/__init__.py	(working copy)
@@ -565,7 +565,7 @@
         internal_type = field.get_internal_type()
         if internal_type == 'DecimalField':
             return value
-        elif internal_type and internal_type.endswith('IntegerField') or internal_type == 'AutoField':
+        elif internal_type and internal_type.endswith('IntegerField') or internal_type.endswith('AutoField'):
             return int(value)
         elif internal_type in ('DateField', 'DateTimeField', 'TimeField'):
             return value
