diff --git a/django/conf/admin_templates/changelist_generic.html b/django/conf/admin_templates/changelist_generic.html
deleted file mode 100644
index d8f51c537b..0000000000
--- a/django/conf/admin_templates/changelist_generic.html
+++ /dev/null
@@ -1,34 +0,0 @@
-{% extends "base_site" %}
-
-{% block bodyclass %}change-list{% endblock %}
-
-{% block content %}
-
-{% if not hide_add_link %}
-
-
-
- {% if toplinks %}
-
-
- {% endif %}
-
- {% if changelist %}
-
- {% endif %}
-
-
-
-
-{% endblock %}
diff --git a/django/conf/global_settings.py b/django/conf/global_settings.py
index 41fe147374..52acb51de4 100644
--- a/django/conf/global_settings.py
+++ b/django/conf/global_settings.py
@@ -65,6 +65,7 @@ TEMPLATE_FILE_EXTENSION = '.html'
# See the comments in django/core/template/loader.py for interface
# documentation.
TEMPLATE_LOADERS = (
+# 'django.core.template.loaders.app_directories.load_template_source',
'django.core.template.loaders.filesystem.load_template_source',
# 'django.core.template.loaders.eggs.load_template_source',
)
@@ -109,7 +110,7 @@ ALLOWED_INCLUDE_ROOTS = ()
# If this is a admin settings module, this should be a list of
# settings modules (in the format 'foo.bar.baz') for which this admin
# is an admin.
-ADMIN_FOR = []
+ADMIN_FOR = ()
# Whether to check the flat-pages table as a last resort for all 404 errors.
USE_FLAT_PAGES = True
diff --git a/django/conf/project_template/settings/main.py b/django/conf/project_template/settings/main.py
index cbb32b7920..1bde7df10a 100644
--- a/django/conf/project_template/settings/main.py
+++ b/django/conf/project_template/settings/main.py
@@ -30,6 +30,13 @@ MEDIA_URL = ''
# Make this unique, and don't share it with anybody.
SECRET_KEY = ''
+# List of callables that know how to import templates from various sources.
+TEMPLATE_LOADERS = (
+# 'django.core.template.loaders.app_directories.load_template_source',
+ 'django.core.template.loaders.filesystem.load_template_source',
+# 'django.core.template.loaders.eggs.load_template_source',
+)
+
MIDDLEWARE_CLASSES = (
"django.middleware.common.CommonMiddleware",
"django.middleware.doc.XViewMiddleware",
diff --git a/django/core/template/loaders/app_directories.py b/django/core/template/loaders/app_directories.py
new file mode 100644
index 0000000000..7319f27fe1
--- /dev/null
+++ b/django/core/template/loaders/app_directories.py
@@ -0,0 +1,28 @@
+# Wrapper for loading templates from "template" directories in installed app packages.
+
+from django.conf.settings import INSTALLED_APPS, TEMPLATE_FILE_EXTENSION
+from django.core.template import TemplateDoesNotExist
+import os
+
+# At compile time, cache the directories to search.
+app_template_dirs = []
+for app in INSTALLED_APPS:
+ i = app.rfind('.')
+ m, a = app[:i], app[i+1:]
+ mod = getattr(__import__(m, '', '', [a]), a)
+ template_dir = os.path.join(os.path.dirname(mod.__file__), 'templates')
+ if os.path.isdir(template_dir):
+ app_template_dirs.append(template_dir)
+
+# It won't change, so convert it to a tuple to save memory.
+app_template_dirs = tuple(app_template_dirs)
+
+def load_template_source(template_name, template_dirs=None):
+ for template_dir in app_template_dirs:
+ filepath = os.path.join(template_dir, template_name) + TEMPLATE_FILE_EXTENSION
+ try:
+ return (open(filepath).read(), filepath)
+ except IOError:
+ pass
+ raise TemplateDoesNotExist, template_name
+load_template_source.is_usable = True
diff --git a/django/core/template/loaders/eggs.py b/django/core/template/loaders/eggs.py
index 012e768af2..d01cfc6412 100644
--- a/django/core/template/loaders/eggs.py
+++ b/django/core/template/loaders/eggs.py
@@ -8,18 +8,18 @@ except ImportError:
from django.core.template import TemplateDoesNotExist
from django.conf.settings import INSTALLED_APPS, TEMPLATE_FILE_EXTENSION
-def load_template_source(name, dirs=None):
+def load_template_source(template_name, template_dirs=None):
"""
Loads templates from Python eggs via pkg_resource.resource_string.
- For every installed app, it tries to get the resource (app, name).
+ For every installed app, it tries to get the resource (app, template_name).
"""
if resource_string is not None:
- pkg_name = 'templates/' + name + TEMPLATE_FILE_EXTENSION
+ pkg_name = 'templates/' + template_name + TEMPLATE_FILE_EXTENSION
for app in INSTALLED_APPS:
try:
return (resource_string(app, pkg_name), 'egg:%s:%s ' % (app, pkg_name))
except:
pass
- raise TemplateDoesNotExist, name
+ raise TemplateDoesNotExist, template_name
load_template_source.is_usable = resource_string is not None
diff --git a/django/core/template/loaders/filesystem.py b/django/core/template/loaders/filesystem.py
index f886cc159a..9a93481705 100644
--- a/django/core/template/loaders/filesystem.py
+++ b/django/core/template/loaders/filesystem.py
@@ -17,6 +17,6 @@ def load_template_source(template_name, template_dirs=None):
if template_dirs:
error_msg = "Tried %s" % tried
else:
- error_msg = "Your TEMPLATE_DIRS settings is empty. Change it to point to at least one template directory."
+ error_msg = "Your TEMPLATE_DIRS setting is empty. Change it to point to at least one template directory."
raise TemplateDoesNotExist, error_msg
load_template_source.is_usable = True
diff --git a/django/views/defaults.py b/django/views/defaults.py
index d283e54c1b..decc220cf7 100644
--- a/django/views/defaults.py
+++ b/django/views/defaults.py
@@ -10,8 +10,12 @@ def shortcut(request, content_type_id, object_id):
obj = content_type.get_object_for_this_type(pk=object_id)
except ObjectDoesNotExist:
raise Http404, "Content type %s object %s doesn't exist" % (content_type_id, object_id)
- if not hasattr(obj, 'get_absolute_url'):
+ try:
+ absurl = obj.get_absolute_url()
+ except AttributeError:
raise Http404, "%s objects don't have get_absolute_url() methods" % content_type.name
+ if absurl.startswith('http://'):
+ return httpwrappers.HttpResponseRedirect(absurl)
object_domain = None
if hasattr(obj, 'get_site_list'):
site_list = obj.get_site_list()
@@ -27,8 +31,8 @@ def shortcut(request, content_type_id, object_id):
except sites.SiteDoesNotExist:
pass
if not object_domain:
- return httpwrappers.HttpResponseRedirect(obj.get_absolute_url())
- return httpwrappers.HttpResponseRedirect('http://%s%s' % (object_domain, obj.get_absolute_url()))
+ return httpwrappers.HttpResponseRedirect(absurl)
+ return httpwrappers.HttpResponseRedirect('http://%s%s' % (object_domain, absurl))
def page_not_found(request):
"""
diff --git a/docs/design_philosophies.txt b/docs/design_philosophies.txt
index 2084c992a5..2988672f02 100644
--- a/docs/design_philosophies.txt
+++ b/docs/design_philosophies.txt
@@ -242,3 +242,9 @@ Loose coupling
A view shouldn't care about which template system the developer uses -- or even
whether a template system is used at all.
+
+Designate between GET and POST
+------------------------------
+
+GET and POST are distinct; developers should explicitly use one or the other.
+The framework should make it easy to distinguish between GET and POST data.
diff --git a/docs/django-admin.txt b/docs/django-admin.txt
index ba9bb1403f..0faabbfcca 100644
--- a/docs/django-admin.txt
+++ b/docs/django-admin.txt
@@ -112,6 +112,11 @@ them to standard output, but it won't stop the server.
You can run as many servers as you want, as long as they're on separate ports.
Just execute ``django-admin.py runserver`` more than once.
+Note that the default IP address, 127.0.0.1, is not accessible from other
+machines on your network. To make your development server viewable to other
+machines on the network, use its own IP address (e.g. ``192.168.2.1``) or
+``0.0.0.0``.
+
Examples:
~~~~~~~~~
diff --git a/docs/model-api.txt b/docs/model-api.txt
index 140518e80e..ee5f9ee723 100644
--- a/docs/model-api.txt
+++ b/docs/model-api.txt
@@ -252,7 +252,7 @@ Here are all available field types:
Using a `FieldField` or an ``ImageField`` (see below) in a model takes a few
steps:
- 1. In your settings file, you'll need to define ``MEDIA_ROOT``as the
+ 1. In your settings file, you'll need to define ``MEDIA_ROOT`` as the
full path to a directory where you'd like Django to store uploaded
files. (For performance, these files are not stored in the database.)
Define ``MEDIA_URL`` as the base public URL of that directory. Make
diff --git a/docs/settings.txt b/docs/settings.txt
new file mode 100644
index 0000000000..382a661be9
--- /dev/null
+++ b/docs/settings.txt
@@ -0,0 +1,521 @@
+===============
+Django settings
+===============
+
+A Django settings file contains all the configuration of your Django
+installation. This document explains how settings work and which settings are
+available.
+
+The basics
+==========
+
+A settings file is just a Python module with module-level variables.
+
+Here are a couple of example settings::
+
+ DEBUG = False
+ DEFAULT_FROM_EMAIL = 'webmaster@example.com'
+ TEMPLATE_DIRS = ('/home/templates/mike', '/home/templates/john')
+
+Because a settings file is a Python module, the following apply:
+
+ * It shouldn't have Python syntax errors.
+ * It can assign settings dynamically using normal Python syntax.
+ For example::
+
+ MY_SETTING = [str(i) for i in range(30)]
+
+ * It can import values from other settings files.
+
+Designating the settings
+========================
+
+When you use Django, you have to tell it which settings you're using. Do this
+by using an environment variable, ``DJANGO_SETTINGS_MODULE``.
+
+The value of ``DJANGO_SETTINGS_MODULE`` should be in Python path syntax, e.g.
+``"myproject.settings.main"``. Note that the settings module should be on the
+Python `import search path`_.
+
+.. _import search path: http://diveintopython.org/getting_to_know_python/everything_is_an_object.html
+
+The django-admin.py utility
+---------------------------
+
+When using `django-admin.py`_, you can either set the environment variable
+once, or explicitly pass in the settings module each time you run the utility.
+
+Example (Unix Bash shell)::
+
+ export DJANGO_SETTINGS_MODULE=myproject.settings.main
+ django-admin.py runserver
+
+Example (Windows shell)::
+
+ set DJANGO_SETTINGS_MODULE=myproject.settings.main
+ django-admin.py runserver
+
+Use the ``--settings`` command-line argument to specify the settings manually::
+
+ django-admin.py runserver --settings=myproject.settings.main
+
+.. _django-admin.py: http://www.djangoproject.com/documentation/django_admin/
+
+On the server (mod_python)
+--------------------------
+
+In your live server environment, you'll need to tell Apache/mod_python which
+settings file to use. Do that with ``SetEnv``::
+
+