Index: django/conf/global_settings.py
===================================================================
--- django/conf/global_settings.py	(revision 10115)
+++ django/conf/global_settings.py	(working copy)
@@ -379,6 +379,9 @@
 # The number of days a password reset link is valid for
 PASSWORD_RESET_TIMEOUT_DAYS = 3
 
+# The class to use as the default AUTH_USER for the authentication system. 
+AUTH_USER_MODULE = None 
+
 ###########
 # TESTING #
 ###########
Index: django/contrib/auth/models.py
===================================================================
--- django/contrib/auth/models.py	(revision 10115)
+++ django/contrib/auth/models.py	(working copy)
@@ -1,6 +1,7 @@
 import datetime
 import urllib
 
+from django.conf import settings
 from django.contrib import auth
 from django.core.exceptions import ImproperlyConfigured
 from django.db import models
@@ -198,7 +199,7 @@
     return False
 
 
-class User(models.Model):
+class UserTemplate(models.Model):
     """
     Users within the Django authentication system are represented by this model.
 
@@ -222,6 +223,7 @@
     class Meta:
         verbose_name = _('user')
         verbose_name_plural = _('users')
+        abstract = True
 
     def __unicode__(self):
         return self.username
@@ -287,6 +289,33 @@
                 raise SiteProfileNotAvailable
         return self._profile_cache
 
+if settings.AUTH_USER_MODULE is not None:
+    # Grab the AUTH_USER_MODULE path and classname from the settings.
+    # auth_user_module_parts[0] = module path
+    # auth_user_module_parts[1] = class name
+    auth_user_module_parts = settings.AUTH_USER_MODULE.rsplit('.', 1)
+    auth_user_module = __import__(auth_user_module_parts[0], {}, {}, [auth_user_module_parts[0]])
+    # Store the auth_user model so it is accessible with the standard
+    # 'from django.contrib.auth.models import User'
+    User = getattr(auth_user_module, auth_user_module_parts[1])
+
+    # Add te User model to the django models cache
+    # These two lines allow the custom auth_user model to play nicely with syncdb
+    # and other systems that rely on functions like
+    # django.db.models.loading.get_model(...)
+    from django.db.models.loading import cache
+    cache.register_models('auth', User)
+
+    # We need to remove whatever we used as the AUTH_USER_MODUlE from the
+    # db cache so apps like contenttypes don't think that it's part
+    # of contrib.auth
+    del cache.app_models['auth'][User.__name__.lower()]
+else:
+    class User(UserTemplate):
+        class Meta:
+            verbose_name = _('user')
+            verbose_name_plural = _('users')
+
 class Message(models.Model):
     """
     The message system is a lightweight way to queue messages for given
Index: django/contrib/auth/models.py
===================================================================
--- django/contrib/admin/sites.py	(revision 10115)
+++ django/contrib/admin/sites.py	(working copy)
@@ -1,7 +1,6 @@
 import re
 from django import http, template
 from django.contrib.admin import ModelAdmin, actions
-from django.contrib.admin.forms import AdminAuthenticationForm
 from django.contrib.auth import REDIRECT_FIELD_NAME
 from django.contrib.contenttypes import views as contenttype_views
 from django.views.decorators.csrf import csrf_protect
@@ -315,6 +314,7 @@
         Displays the login form for the given HttpRequest.
         """
         from django.contrib.auth.views import login
+        from django.contrib.admin.forms import AdminAuthenticationForm
         context = {
             'title': _('Log in'),
             'root_path': self.root_path,
