diff --git a/django/conf/project_template/settings/main.py b/django/conf/project_template/settings.py similarity index 80% rename from django/conf/project_template/settings/main.py rename to django/conf/project_template/settings.py index 1bde7df10ae..838375cbb76 100644 --- a/django/conf/project_template/settings/main.py +++ b/django/conf/project_template/settings.py @@ -27,22 +27,28 @@ MEDIA_ROOT = '' # Example: "http://media.lawrence.com" MEDIA_URL = '' +# URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a +# trailing slash. +# Examples: "http://foo.com/media/", "/media/". +ADMIN_MEDIA_PREFIX = '/media/' + # 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.app_directories.load_template_source', # 'django.core.template.loaders.eggs.load_template_source', ) MIDDLEWARE_CLASSES = ( "django.middleware.common.CommonMiddleware", + "django.middleware.sessions.SessionMiddleware", "django.middleware.doc.XViewMiddleware", ) -ROOT_URLCONF = '{{ project_name }}.settings.urls.main' +ROOT_URLCONF = '{{ project_name }}.urls' TEMPLATE_DIRS = ( # Put strings here, like "/home/html/django_templates". diff --git a/django/conf/project_template/settings/__init__.py b/django/conf/project_template/settings/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/django/conf/project_template/settings/admin.py b/django/conf/project_template/settings/admin.py deleted file mode 100644 index 603886a5f20..00000000000 --- a/django/conf/project_template/settings/admin.py +++ /dev/null @@ -1,18 +0,0 @@ -# Django settings for {{ project_name }} project admin site. - -from main import * - -TEMPLATE_DIRS = ( - # Put strings here, like "/home/html/django_templates". -) -ROOT_URLCONF = '{{ project_name }}.settings.urls.admin' -MIDDLEWARE_CLASSES = ( - 'django.middleware.sessions.SessionMiddleware', - 'django.middleware.admin.AdminUserRequired', - 'django.middleware.common.CommonMiddleware', -) - -# URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a -# trailing slash. -# Examples: "http://foo.com/media/", "/media/". -ADMIN_MEDIA_PREFIX = '/media/' diff --git a/django/conf/project_template/settings/urls/__init__.py b/django/conf/project_template/settings/urls/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/django/conf/project_template/settings/urls/admin.py b/django/conf/project_template/settings/urls/admin.py deleted file mode 100644 index c3eb86d3cbc..00000000000 --- a/django/conf/project_template/settings/urls/admin.py +++ /dev/null @@ -1,6 +0,0 @@ -from django.conf.urls.defaults import * - -urlpatterns = patterns('', - (r'^admin/', include('django.conf.urls.admin')), - (r'^r/', include('django.conf.urls.shortcut')), -) diff --git a/django/conf/project_template/settings/urls/main.py b/django/conf/project_template/urls.py similarity index 63% rename from django/conf/project_template/settings/urls/main.py rename to django/conf/project_template/urls.py index f9b993a52c4..fe77ea1867d 100644 --- a/django/conf/project_template/settings/urls/main.py +++ b/django/conf/project_template/urls.py @@ -3,4 +3,7 @@ from django.conf.urls.defaults import * urlpatterns = patterns('', # Example: # (r'^{{ project_name }}/', include('{{ project_name }}.apps.foo.urls.foo')), + + # Uncomment this for admin: +# (r'^admin/', include('django.contrib.admin.urls.admin')), ) diff --git a/django/conf/admin_media/css/base.css b/django/contrib/admin/media/css/base.css similarity index 100% rename from django/conf/admin_media/css/base.css rename to django/contrib/admin/media/css/base.css diff --git a/django/conf/admin_media/css/changelists.css b/django/contrib/admin/media/css/changelists.css similarity index 100% rename from django/conf/admin_media/css/changelists.css rename to django/contrib/admin/media/css/changelists.css diff --git a/django/conf/admin_media/css/global.css b/django/contrib/admin/media/css/global.css similarity index 100% rename from django/conf/admin_media/css/global.css rename to django/contrib/admin/media/css/global.css diff --git a/django/conf/admin_media/img/admin/arrow-down.gif b/django/contrib/admin/media/img/admin/arrow-down.gif similarity index 100% rename from django/conf/admin_media/img/admin/arrow-down.gif rename to django/contrib/admin/media/img/admin/arrow-down.gif diff --git a/django/conf/admin_media/img/admin/arrow-up.gif b/django/contrib/admin/media/img/admin/arrow-up.gif similarity index 100% rename from django/conf/admin_media/img/admin/arrow-up.gif rename to django/contrib/admin/media/img/admin/arrow-up.gif diff --git a/django/conf/admin_media/img/admin/changelist-bg.gif b/django/contrib/admin/media/img/admin/changelist-bg.gif similarity index 100% rename from django/conf/admin_media/img/admin/changelist-bg.gif rename to django/contrib/admin/media/img/admin/changelist-bg.gif diff --git a/django/conf/admin_media/img/admin/chooser-bg.gif b/django/contrib/admin/media/img/admin/chooser-bg.gif similarity index 100% rename from django/conf/admin_media/img/admin/chooser-bg.gif rename to django/contrib/admin/media/img/admin/chooser-bg.gif diff --git a/django/conf/admin_media/img/admin/chooser_stacked-bg.gif b/django/contrib/admin/media/img/admin/chooser_stacked-bg.gif similarity index 100% rename from django/conf/admin_media/img/admin/chooser_stacked-bg.gif rename to django/contrib/admin/media/img/admin/chooser_stacked-bg.gif diff --git a/django/conf/admin_media/img/admin/default-bg-reverse.gif b/django/contrib/admin/media/img/admin/default-bg-reverse.gif similarity index 100% rename from django/conf/admin_media/img/admin/default-bg-reverse.gif rename to django/contrib/admin/media/img/admin/default-bg-reverse.gif diff --git a/django/conf/admin_media/img/admin/default-bg.gif b/django/contrib/admin/media/img/admin/default-bg.gif similarity index 100% rename from django/conf/admin_media/img/admin/default-bg.gif rename to django/contrib/admin/media/img/admin/default-bg.gif diff --git a/django/conf/admin_media/img/admin/icon-no.gif b/django/contrib/admin/media/img/admin/icon-no.gif similarity index 100% rename from django/conf/admin_media/img/admin/icon-no.gif rename to django/contrib/admin/media/img/admin/icon-no.gif diff --git a/django/conf/admin_media/img/admin/icon-yes.gif b/django/contrib/admin/media/img/admin/icon-yes.gif similarity index 100% rename from django/conf/admin_media/img/admin/icon-yes.gif rename to django/contrib/admin/media/img/admin/icon-yes.gif diff --git a/django/conf/admin_media/img/admin/icon_addlink.gif b/django/contrib/admin/media/img/admin/icon_addlink.gif similarity index 100% rename from django/conf/admin_media/img/admin/icon_addlink.gif rename to django/contrib/admin/media/img/admin/icon_addlink.gif diff --git a/django/conf/admin_media/img/admin/icon_alert.gif b/django/contrib/admin/media/img/admin/icon_alert.gif similarity index 100% rename from django/conf/admin_media/img/admin/icon_alert.gif rename to django/contrib/admin/media/img/admin/icon_alert.gif diff --git a/django/conf/admin_media/img/admin/icon_calendar.gif b/django/contrib/admin/media/img/admin/icon_calendar.gif similarity index 100% rename from django/conf/admin_media/img/admin/icon_calendar.gif rename to django/contrib/admin/media/img/admin/icon_calendar.gif diff --git a/django/conf/admin_media/img/admin/icon_changelink.gif b/django/contrib/admin/media/img/admin/icon_changelink.gif similarity index 100% rename from django/conf/admin_media/img/admin/icon_changelink.gif rename to django/contrib/admin/media/img/admin/icon_changelink.gif diff --git a/django/conf/admin_media/img/admin/icon_clock.gif b/django/contrib/admin/media/img/admin/icon_clock.gif similarity index 100% rename from django/conf/admin_media/img/admin/icon_clock.gif rename to django/contrib/admin/media/img/admin/icon_clock.gif diff --git a/django/conf/admin_media/img/admin/icon_deletelink.gif b/django/contrib/admin/media/img/admin/icon_deletelink.gif similarity index 100% rename from django/conf/admin_media/img/admin/icon_deletelink.gif rename to django/contrib/admin/media/img/admin/icon_deletelink.gif diff --git a/django/conf/admin_media/img/admin/icon_error.gif b/django/contrib/admin/media/img/admin/icon_error.gif similarity index 100% rename from django/conf/admin_media/img/admin/icon_error.gif rename to django/contrib/admin/media/img/admin/icon_error.gif diff --git a/django/conf/admin_media/img/admin/icon_searchbox.png b/django/contrib/admin/media/img/admin/icon_searchbox.png similarity index 100% rename from django/conf/admin_media/img/admin/icon_searchbox.png rename to django/contrib/admin/media/img/admin/icon_searchbox.png diff --git a/django/conf/admin_media/img/admin/icon_success.gif b/django/contrib/admin/media/img/admin/icon_success.gif similarity index 100% rename from django/conf/admin_media/img/admin/icon_success.gif rename to django/contrib/admin/media/img/admin/icon_success.gif diff --git a/django/conf/admin_media/img/admin/nav-bg-grabber.gif b/django/contrib/admin/media/img/admin/nav-bg-grabber.gif similarity index 100% rename from django/conf/admin_media/img/admin/nav-bg-grabber.gif rename to django/contrib/admin/media/img/admin/nav-bg-grabber.gif diff --git a/django/conf/admin_media/img/admin/nav-bg-reverse.gif b/django/contrib/admin/media/img/admin/nav-bg-reverse.gif similarity index 100% rename from django/conf/admin_media/img/admin/nav-bg-reverse.gif rename to django/contrib/admin/media/img/admin/nav-bg-reverse.gif diff --git a/django/conf/admin_media/img/admin/nav-bg.gif b/django/contrib/admin/media/img/admin/nav-bg.gif similarity index 100% rename from django/conf/admin_media/img/admin/nav-bg.gif rename to django/contrib/admin/media/img/admin/nav-bg.gif diff --git a/django/conf/admin_media/img/admin/selector-add.gif b/django/contrib/admin/media/img/admin/selector-add.gif similarity index 100% rename from django/conf/admin_media/img/admin/selector-add.gif rename to django/contrib/admin/media/img/admin/selector-add.gif diff --git a/django/conf/admin_media/img/admin/selector-addall.gif b/django/contrib/admin/media/img/admin/selector-addall.gif similarity index 100% rename from django/conf/admin_media/img/admin/selector-addall.gif rename to django/contrib/admin/media/img/admin/selector-addall.gif diff --git a/django/conf/admin_media/img/admin/selector-remove.gif b/django/contrib/admin/media/img/admin/selector-remove.gif similarity index 100% rename from django/conf/admin_media/img/admin/selector-remove.gif rename to django/contrib/admin/media/img/admin/selector-remove.gif diff --git a/django/conf/admin_media/img/admin/selector-removeall.gif b/django/contrib/admin/media/img/admin/selector-removeall.gif similarity index 100% rename from django/conf/admin_media/img/admin/selector-removeall.gif rename to django/contrib/admin/media/img/admin/selector-removeall.gif diff --git a/django/conf/admin_media/img/admin/selector-search.gif b/django/contrib/admin/media/img/admin/selector-search.gif similarity index 100% rename from django/conf/admin_media/img/admin/selector-search.gif rename to django/contrib/admin/media/img/admin/selector-search.gif diff --git a/django/conf/admin_media/img/admin/selector_stacked-add.gif b/django/contrib/admin/media/img/admin/selector_stacked-add.gif similarity index 100% rename from django/conf/admin_media/img/admin/selector_stacked-add.gif rename to django/contrib/admin/media/img/admin/selector_stacked-add.gif diff --git a/django/conf/admin_media/img/admin/selector_stacked-remove.gif b/django/contrib/admin/media/img/admin/selector_stacked-remove.gif similarity index 100% rename from django/conf/admin_media/img/admin/selector_stacked-remove.gif rename to django/contrib/admin/media/img/admin/selector_stacked-remove.gif diff --git a/django/conf/admin_media/img/admin/tool-left.gif b/django/contrib/admin/media/img/admin/tool-left.gif similarity index 100% rename from django/conf/admin_media/img/admin/tool-left.gif rename to django/contrib/admin/media/img/admin/tool-left.gif diff --git a/django/conf/admin_media/img/admin/tool-left_over.gif b/django/contrib/admin/media/img/admin/tool-left_over.gif similarity index 100% rename from django/conf/admin_media/img/admin/tool-left_over.gif rename to django/contrib/admin/media/img/admin/tool-left_over.gif diff --git a/django/conf/admin_media/img/admin/tool-right.gif b/django/contrib/admin/media/img/admin/tool-right.gif similarity index 100% rename from django/conf/admin_media/img/admin/tool-right.gif rename to django/contrib/admin/media/img/admin/tool-right.gif diff --git a/django/conf/admin_media/img/admin/tool-right_over.gif b/django/contrib/admin/media/img/admin/tool-right_over.gif similarity index 100% rename from django/conf/admin_media/img/admin/tool-right_over.gif rename to django/contrib/admin/media/img/admin/tool-right_over.gif diff --git a/django/conf/admin_media/img/admin/tooltag-add.gif b/django/contrib/admin/media/img/admin/tooltag-add.gif similarity index 100% rename from django/conf/admin_media/img/admin/tooltag-add.gif rename to django/contrib/admin/media/img/admin/tooltag-add.gif diff --git a/django/conf/admin_media/img/admin/tooltag-add_over.gif b/django/contrib/admin/media/img/admin/tooltag-add_over.gif similarity index 100% rename from django/conf/admin_media/img/admin/tooltag-add_over.gif rename to django/contrib/admin/media/img/admin/tooltag-add_over.gif diff --git a/django/conf/admin_media/img/admin/tooltag-arrowright.gif b/django/contrib/admin/media/img/admin/tooltag-arrowright.gif similarity index 100% rename from django/conf/admin_media/img/admin/tooltag-arrowright.gif rename to django/contrib/admin/media/img/admin/tooltag-arrowright.gif diff --git a/django/conf/admin_media/img/admin/tooltag-arrowright_over.gif b/django/contrib/admin/media/img/admin/tooltag-arrowright_over.gif similarity index 100% rename from django/conf/admin_media/img/admin/tooltag-arrowright_over.gif rename to django/contrib/admin/media/img/admin/tooltag-arrowright_over.gif diff --git a/django/conf/admin_media/js/SelectBox.js b/django/contrib/admin/media/js/SelectBox.js similarity index 100% rename from django/conf/admin_media/js/SelectBox.js rename to django/contrib/admin/media/js/SelectBox.js diff --git a/django/conf/admin_media/js/SelectFilter.js b/django/contrib/admin/media/js/SelectFilter.js similarity index 100% rename from django/conf/admin_media/js/SelectFilter.js rename to django/contrib/admin/media/js/SelectFilter.js diff --git a/django/conf/admin_media/js/SelectFilter2.js b/django/contrib/admin/media/js/SelectFilter2.js similarity index 100% rename from django/conf/admin_media/js/SelectFilter2.js rename to django/contrib/admin/media/js/SelectFilter2.js diff --git a/django/conf/admin_media/js/admin/CollapsedFieldsets.js b/django/contrib/admin/media/js/admin/CollapsedFieldsets.js similarity index 100% rename from django/conf/admin_media/js/admin/CollapsedFieldsets.js rename to django/contrib/admin/media/js/admin/CollapsedFieldsets.js diff --git a/django/conf/admin_media/js/admin/DateTimeShortcuts.js b/django/contrib/admin/media/js/admin/DateTimeShortcuts.js similarity index 100% rename from django/conf/admin_media/js/admin/DateTimeShortcuts.js rename to django/contrib/admin/media/js/admin/DateTimeShortcuts.js diff --git a/django/conf/admin_media/js/admin/RelatedObjectLookups.js b/django/contrib/admin/media/js/admin/RelatedObjectLookups.js similarity index 100% rename from django/conf/admin_media/js/admin/RelatedObjectLookups.js rename to django/contrib/admin/media/js/admin/RelatedObjectLookups.js diff --git a/django/conf/admin_media/js/admin/ordering.js b/django/contrib/admin/media/js/admin/ordering.js similarity index 100% rename from django/conf/admin_media/js/admin/ordering.js rename to django/contrib/admin/media/js/admin/ordering.js diff --git a/django/conf/admin_media/js/calendar.js b/django/contrib/admin/media/js/calendar.js similarity index 100% rename from django/conf/admin_media/js/calendar.js rename to django/contrib/admin/media/js/calendar.js diff --git a/django/conf/admin_media/js/core.js b/django/contrib/admin/media/js/core.js similarity index 100% rename from django/conf/admin_media/js/core.js rename to django/contrib/admin/media/js/core.js diff --git a/django/conf/admin_media/js/dateparse.js b/django/contrib/admin/media/js/dateparse.js similarity index 100% rename from django/conf/admin_media/js/dateparse.js rename to django/contrib/admin/media/js/dateparse.js diff --git a/django/conf/admin_media/js/getElementsBySelector.js b/django/contrib/admin/media/js/getElementsBySelector.js similarity index 100% rename from django/conf/admin_media/js/getElementsBySelector.js rename to django/contrib/admin/media/js/getElementsBySelector.js diff --git a/django/conf/admin_media/js/timeparse.js b/django/contrib/admin/media/js/timeparse.js similarity index 100% rename from django/conf/admin_media/js/timeparse.js rename to django/contrib/admin/media/js/timeparse.js diff --git a/django/conf/admin_media/js/urlify.js b/django/contrib/admin/media/js/urlify.js similarity index 100% rename from django/conf/admin_media/js/urlify.js rename to django/contrib/admin/media/js/urlify.js diff --git a/django/conf/admin_templates/404.html b/django/contrib/admin/templates/admin/404.html similarity index 84% rename from django/conf/admin_templates/404.html rename to django/contrib/admin/templates/admin/404.html index 099466c4f12..9d7876ecbf9 100644 --- a/django/conf/admin_templates/404.html +++ b/django/contrib/admin/templates/admin/404.html @@ -1,4 +1,4 @@ -{% extends "base_site" %} +{% extends "admin/base_site" %} {% block title %}Page not found{% endblock %} diff --git a/django/conf/admin_templates/500.html b/django/contrib/admin/templates/admin/500.html similarity index 92% rename from django/conf/admin_templates/500.html rename to django/contrib/admin/templates/admin/500.html index 124e4018a99..34a28ff0f5a 100644 --- a/django/conf/admin_templates/500.html +++ b/django/contrib/admin/templates/admin/500.html @@ -1,4 +1,4 @@ -{% extends "base_site" %} +{% extends "admin/base_site" %} {% block breadcrumbs %}
{% endblock %} diff --git a/django/conf/admin_templates/base.html b/django/contrib/admin/templates/admin/base.html similarity index 100% rename from django/conf/admin_templates/base.html rename to django/contrib/admin/templates/admin/base.html diff --git a/django/conf/admin_templates/base_site.html b/django/contrib/admin/templates/admin/base_site.html similarity index 90% rename from django/conf/admin_templates/base_site.html rename to django/contrib/admin/templates/admin/base_site.html index 8e0874e4019..7113c06d6c3 100644 --- a/django/conf/admin_templates/base_site.html +++ b/django/contrib/admin/templates/admin/base_site.html @@ -1,4 +1,4 @@ -{% extends "base" %} +{% extends "admin/base" %} {% block title %}{{ title }} | Django site admin{% endblock %} diff --git a/django/conf/admin_templates/delete_confirmation_generic.html b/django/contrib/admin/templates/admin/delete_confirmation.html similarity index 95% rename from django/conf/admin_templates/delete_confirmation_generic.html rename to django/contrib/admin/templates/admin/delete_confirmation.html index e46b611bafa..99b1cdce7a1 100644 --- a/django/conf/admin_templates/delete_confirmation_generic.html +++ b/django/contrib/admin/templates/admin/delete_confirmation.html @@ -1,4 +1,4 @@ -{% extends "base_site" %} +{% extends "admin/base_site" %} {% block content %} diff --git a/django/conf/admin_templates/index.html b/django/contrib/admin/templates/admin/index.html similarity index 98% rename from django/conf/admin_templates/index.html rename to django/contrib/admin/templates/admin/index.html index 7610b3a0231..02c5bd84390 100644 --- a/django/conf/admin_templates/index.html +++ b/django/contrib/admin/templates/admin/index.html @@ -1,4 +1,4 @@ -{% extends "base_site" %} +{% extends "admin/base_site" %} {% block coltype %}colMS{% endblock %} {% block bodyclass %}dashboard{% endblock %} diff --git a/django/conf/admin_templates/login.html b/django/contrib/admin/templates/admin/login.html similarity index 96% rename from django/conf/admin_templates/login.html rename to django/contrib/admin/templates/admin/login.html index 7dec8e796a4..ef4aa5aae25 100644 --- a/django/conf/admin_templates/login.html +++ b/django/contrib/admin/templates/admin/login.html @@ -1,4 +1,4 @@ -{% extends "base_site" %} +{% extends "admin/base_site" %} {% block breadcrumbs %}{% endblock %} diff --git a/django/conf/admin_templates/admin_object_history.html b/django/contrib/admin/templates/admin/object_history.html similarity index 97% rename from django/conf/admin_templates/admin_object_history.html rename to django/contrib/admin/templates/admin/object_history.html index 580d47760f1..d50936665a8 100644 --- a/django/conf/admin_templates/admin_object_history.html +++ b/django/contrib/admin/templates/admin/object_history.html @@ -1,4 +1,4 @@ -{% extends "base_site" %} +{% extends "admin/base_site" %} {% block breadcrumbs %} diff --git a/django/conf/admin_templates/template_validator.html b/django/contrib/admin/templates/admin/template_validator.html similarity index 96% rename from django/conf/admin_templates/template_validator.html rename to django/contrib/admin/templates/admin/template_validator.html index ddd9775f9f4..f9ac09a77d2 100644 --- a/django/conf/admin_templates/template_validator.html +++ b/django/contrib/admin/templates/admin/template_validator.html @@ -1,4 +1,4 @@ -{% extends "base_site" %} +{% extends "admin/base_site" %} {% block content %} diff --git a/django/conf/admin_templates/doc/bookmarklets.html b/django/contrib/admin/templates/admin_doc/bookmarklets.html similarity index 99% rename from django/conf/admin_templates/doc/bookmarklets.html rename to django/contrib/admin/templates/admin_doc/bookmarklets.html index 9c64d32837e..d396ec53b53 100644 --- a/django/conf/admin_templates/doc/bookmarklets.html +++ b/django/contrib/admin/templates/admin_doc/bookmarklets.html @@ -1,4 +1,4 @@ -{% extends "base_site" %} +{% extends "admin/base_site" %} {% block breadcrumbs %} {% endblock %} diff --git a/django/conf/admin_templates/doc/index.html b/django/contrib/admin/templates/admin_doc/index.html similarity index 94% rename from django/conf/admin_templates/doc/index.html rename to django/contrib/admin/templates/admin_doc/index.html index e205d0a486b..77d2a96bf2d 100644 --- a/django/conf/admin_templates/doc/index.html +++ b/django/contrib/admin/templates/admin_doc/index.html @@ -1,4 +1,4 @@ -{% extends "base_site" %} +{% extends "admin/base_site" %} {% block breadcrumbs %} {% endblock %} diff --git a/django/conf/admin_templates/doc/missing_docutils.html b/django/contrib/admin/templates/admin_doc/missing_docutils.html similarity index 93% rename from django/conf/admin_templates/doc/missing_docutils.html rename to django/contrib/admin/templates/admin_doc/missing_docutils.html index 2a47be26be5..40004c41abb 100644 --- a/django/conf/admin_templates/doc/missing_docutils.html +++ b/django/contrib/admin/templates/admin_doc/missing_docutils.html @@ -1,4 +1,4 @@ -{% extends "base_site" %} +{% extends "admin/base_site" %} {% block breadcrumbs %} {% endblock %} diff --git a/django/conf/admin_templates/doc/model_detail.html b/django/contrib/admin/templates/admin_doc/model_detail.html similarity index 96% rename from django/conf/admin_templates/doc/model_detail.html rename to django/contrib/admin/templates/admin_doc/model_detail.html index bd58d2a9f15..d3621b7434f 100644 --- a/django/conf/admin_templates/doc/model_detail.html +++ b/django/contrib/admin/templates/admin_doc/model_detail.html @@ -1,4 +1,4 @@ -{% extends "base_site" %} +{% extends "admin/base_site" %} {% block extrahead %} diff --git a/django/conf/admin_templates/doc/model_index.html b/django/contrib/admin/templates/admin_doc/model_index.html similarity index 96% rename from django/conf/admin_templates/doc/model_index.html rename to django/contrib/admin/templates/admin_doc/model_index.html index c1554c0911a..5896ee136e4 100644 --- a/django/conf/admin_templates/doc/model_index.html +++ b/django/contrib/admin/templates/admin_doc/model_index.html @@ -1,4 +1,4 @@ -{% extends "base_site" %} +{% extends "admin/base_site" %} {% block coltype %}colSM{% endblock %} diff --git a/django/conf/admin_templates/doc/template_detail.html b/django/contrib/admin/templates/admin_doc/template_detail.html similarity index 96% rename from django/conf/admin_templates/doc/template_detail.html rename to django/contrib/admin/templates/admin_doc/template_detail.html index 374b737022a..448ff212ba4 100644 --- a/django/conf/admin_templates/doc/template_detail.html +++ b/django/contrib/admin/templates/admin_doc/template_detail.html @@ -1,4 +1,4 @@ -{% extends "base_site" %} +{% extends "admin/base_site" %} {% block breadcrumbs %} {% endblock %} diff --git a/django/conf/admin_templates/doc/template_filter_index.html b/django/contrib/admin/templates/admin_doc/template_filter_index.html similarity index 98% rename from django/conf/admin_templates/doc/template_filter_index.html rename to django/contrib/admin/templates/admin_doc/template_filter_index.html index 0dc651a2149..23f08624570 100644 --- a/django/conf/admin_templates/doc/template_filter_index.html +++ b/django/contrib/admin/templates/admin_doc/template_filter_index.html @@ -1,4 +1,4 @@ -{% extends "base_site" %} +{% extends "admin/base_site" %} {% block coltype %}colSM{% endblock %} diff --git a/django/conf/admin_templates/doc/template_tag_index.html b/django/contrib/admin/templates/admin_doc/template_tag_index.html similarity index 97% rename from django/conf/admin_templates/doc/template_tag_index.html rename to django/contrib/admin/templates/admin_doc/template_tag_index.html index 52ab08756a7..83b25723222 100644 --- a/django/conf/admin_templates/doc/template_tag_index.html +++ b/django/contrib/admin/templates/admin_doc/template_tag_index.html @@ -1,4 +1,4 @@ -{% extends "base_site" %} +{% extends "admin/base_site" %} {% block coltype %}colSM{% endblock %} diff --git a/django/conf/admin_templates/doc/view_detail.html b/django/contrib/admin/templates/admin_doc/view_detail.html similarity index 94% rename from django/conf/admin_templates/doc/view_detail.html rename to django/contrib/admin/templates/admin_doc/view_detail.html index 3fe26b34880..9fb06e7eb7a 100644 --- a/django/conf/admin_templates/doc/view_detail.html +++ b/django/contrib/admin/templates/admin_doc/view_detail.html @@ -1,4 +1,4 @@ -{% extends "base_site" %} +{% extends "admin/base_site" %} {% block breadcrumbs %} {% endblock %} diff --git a/django/conf/admin_templates/doc/view_index.html b/django/contrib/admin/templates/admin_doc/view_index.html similarity index 93% rename from django/conf/admin_templates/doc/view_index.html rename to django/contrib/admin/templates/admin_doc/view_index.html index c14b1f07ac4..90ef5b1c90f 100644 --- a/django/conf/admin_templates/doc/view_index.html +++ b/django/contrib/admin/templates/admin_doc/view_index.html @@ -1,4 +1,4 @@ -{% extends "base_site" %} +{% extends "admin/base_site" %} {% block coltype %}colSM{% endblock %} diff --git a/django/conf/admin_templates/registration/logged_out.html b/django/contrib/admin/templates/registration/logged_out.html similarity index 88% rename from django/conf/admin_templates/registration/logged_out.html rename to django/contrib/admin/templates/registration/logged_out.html index 92cf77e35b9..1f4bd297906 100644 --- a/django/conf/admin_templates/registration/logged_out.html +++ b/django/contrib/admin/templates/registration/logged_out.html @@ -1,4 +1,4 @@ -{% extends "base_site" %} +{% extends "admin/base_site" %} {% block breadcrumbs %} {% endblock %} diff --git a/django/conf/admin_templates/registration/password_change_done.html b/django/contrib/admin/templates/registration/password_change_done.html similarity index 89% rename from django/conf/admin_templates/registration/password_change_done.html rename to django/contrib/admin/templates/registration/password_change_done.html index 8028c9f0d90..4345b9bcaa8 100644 --- a/django/conf/admin_templates/registration/password_change_done.html +++ b/django/contrib/admin/templates/registration/password_change_done.html @@ -1,4 +1,4 @@ -{% extends "base_site" %} +{% extends "admin/base_site" %} {% block breadcrumbs %} {% endblock %} diff --git a/django/conf/admin_templates/registration/password_change_form.html b/django/contrib/admin/templates/registration/password_change_form.html similarity index 97% rename from django/conf/admin_templates/registration/password_change_form.html rename to django/contrib/admin/templates/registration/password_change_form.html index 8ceefed86e8..104249991c9 100644 --- a/django/conf/admin_templates/registration/password_change_form.html +++ b/django/contrib/admin/templates/registration/password_change_form.html @@ -1,4 +1,4 @@ -{% extends "base_site" %} +{% extends "admin/base_site" %} {% block breadcrumbs %} {% endblock %} diff --git a/django/conf/admin_templates/registration/password_reset_done.html b/django/contrib/admin/templates/registration/password_reset_done.html similarity index 91% rename from django/conf/admin_templates/registration/password_reset_done.html rename to django/contrib/admin/templates/registration/password_reset_done.html index 5c41d9f1d50..a8573e8e0e4 100644 --- a/django/conf/admin_templates/registration/password_reset_done.html +++ b/django/contrib/admin/templates/registration/password_reset_done.html @@ -1,4 +1,4 @@ -{% extends "base_site" %} +{% extends "admin/base_site" %} {% block breadcrumbs %} {% endblock %} diff --git a/django/conf/admin_templates/registration/password_reset_email.html b/django/contrib/admin/templates/registration/password_reset_email.html similarity index 100% rename from django/conf/admin_templates/registration/password_reset_email.html rename to django/contrib/admin/templates/registration/password_reset_email.html diff --git a/django/conf/admin_templates/registration/password_reset_form.html b/django/contrib/admin/templates/registration/password_reset_form.html similarity index 94% rename from django/conf/admin_templates/registration/password_reset_form.html rename to django/contrib/admin/templates/registration/password_reset_form.html index c2dae2a5b30..4f9bcb5fc58 100644 --- a/django/conf/admin_templates/registration/password_reset_form.html +++ b/django/contrib/admin/templates/registration/password_reset_form.html @@ -1,4 +1,4 @@ -{% extends "base_site" %} +{% extends "admin/base_site" %} {% block breadcrumbs %} {% endblock %} diff --git a/django/templatetags/adminapplist.py b/django/contrib/admin/templatetags/adminapplist.py similarity index 100% rename from django/templatetags/adminapplist.py rename to django/contrib/admin/templatetags/adminapplist.py diff --git a/django/templatetags/adminmedia.py b/django/contrib/admin/templatetags/adminmedia.py similarity index 100% rename from django/templatetags/adminmedia.py rename to django/contrib/admin/templatetags/adminmedia.py diff --git a/django/templatetags/log.py b/django/contrib/admin/templatetags/log.py similarity index 98% rename from django/templatetags/log.py rename to django/contrib/admin/templatetags/log.py index c88e28dabeb..b24f7c1dad9 100644 --- a/django/templatetags/log.py +++ b/django/contrib/admin/templatetags/log.py @@ -1,4 +1,4 @@ -from django.models.auth import log +from django.models.admin import log from django.core import template class AdminLogNode(template.Node): diff --git a/django/conf/urls/admin.py b/django/contrib/admin/urls/admin.py similarity index 100% rename from django/conf/urls/admin.py rename to django/contrib/admin/urls/admin.py diff --git a/django/contrib/admin/views/main.py b/django/contrib/admin/views/main.py index 685f3b6cba8..8ecf0a2c97d 100644 --- a/django/contrib/admin/views/main.py +++ b/django/contrib/admin/views/main.py @@ -6,7 +6,7 @@ from django.core.template import loader from django.core.exceptions import Http404, ObjectDoesNotExist, PermissionDenied from django.core.extensions import DjangoContext as Context from django.core.extensions import get_object_or_404, render_to_response -from django.models.auth import log +from django.models.admin import log from django.utils.html import strip_tags from django.utils.httpwrappers import HttpResponse, HttpResponseRedirect from django.utils.text import capfirst, get_text_list @@ -49,7 +49,7 @@ def get_query_string(original_params, new_params={}, remove=[]): return '?' + '&'.join(['%s=%s' % (k, v) for k, v in p.items()]).replace(' ', '%20') def index(request): - return render_to_response('index', {'title': 'Site administration'}, context_instance=Context(request)) + return render_to_response('admin/index', {'title': 'Site administration'}, context_instance=Context(request)) index = staff_member_required(index) def change_list(request, app_label, module_name): @@ -266,7 +266,7 @@ def change_list(request, app_label, module_name): else: pass # Invalid argument to "list_filter" - raw_template = ['{% extends "base_site" %}\n'] + raw_template = ['{% extends "admin/base_site" %}\n'] raw_template.append('{% block bodyclass %}change-list{% endblock %}\n') if not is_popup: raw_template.append('{%% block breadcrumbs %%} {%% endblock %%}\n' % capfirst(opts.verbose_name_plural)) @@ -538,7 +538,7 @@ def _get_template(opts, app_label, add=False, change=False, show_delete=False, f admin_field_objs = opts.admin.get_field_objs(opts) ordered_objects = opts.get_ordered_objects()[:] auto_populated_fields = [f for f in opts.fields if f.prepopulate_from] - t = ['{% extends "base_site" %}\n'] + t = ['{% extends "admin/base_site" %}\n'] t.append('{% block extrahead %}') # Put in any necessary JavaScript imports. @@ -1087,7 +1087,7 @@ def delete_stage(request, app_label, module_name, object_id): log.log_action(request.user.id, opts.get_content_type_id(), object_id, obj_repr, log.DELETION) request.user.add_message('The %s "%s" was deleted successfully.' % (opts.verbose_name, obj_repr)) return HttpResponseRedirect("../../") - return render_to_response('delete_confirmation_generic', { + return render_to_response('admin/delete_confirmation', { "title": "Are you sure?", "object_name": opts.verbose_name, "object": obj, @@ -1102,7 +1102,7 @@ def history(request, app_label, module_name, object_id): order_by=("action_time",), select_related=True) # If no history was found, see whether this object even exists. obj = get_object_or_404(mod, pk=object_id) - return render_to_response('admin_object_history', { + return render_to_response('admin/object_history', { 'title': 'Change history: %r' % obj, 'action_list': action_list, 'module_name': capfirst(opts.verbose_name_plural), diff --git a/django/contrib/admin/views/template.py b/django/contrib/admin/views/template.py index 97f67e04c10..fbac6d4f123 100644 --- a/django/contrib/admin/views/template.py +++ b/django/contrib/admin/views/template.py @@ -23,7 +23,7 @@ def template_validator(request): errors = manipulator.get_validation_errors(new_data) if not errors: request.user.add_message('The template is valid.') - return render_to_response('template_validator', { + return render_to_response('admin/template_validator', { 'title': 'Template validator', 'form': formfields.FormWrapper(manipulator, new_data, errors), }, context_instance=DjangoContext(request)) diff --git a/django/core/management.py b/django/core/management.py index 046031e311f..564697776d2 100644 --- a/django/core/management.py +++ b/django/core/management.py @@ -17,7 +17,6 @@ APP_ARGS = '[modelmodule ...]' # Use django.__path__[0] because we don't know which directory django into # which has been installed. PROJECT_TEMPLATE_DIR = os.path.join(django.__path__[0], 'conf', '%s_template') -ADMIN_TEMPLATE_DIR = os.path.join(django.__path__[0], 'conf', 'admin_templates') def _get_packages_insert(app_label): return "INSERT INTO packages (label, name) VALUES ('%s', '%s');" % (app_label, app_label) @@ -142,7 +141,7 @@ def get_sql_delete(mod): if cursor is not None: cursor.execute("SELECT id FROM content_types WHERE package = %s", [app_label]) for row in cursor.fetchall(): - output.append("DELETE FROM auth_admin_log WHERE content_type_id = %s;" % row[0]) + output.append("DELETE FROM django_admin_log WHERE content_type_id = %s;" % row[0]) # Close database connection explicitly, in case this output is being piped # directly into a database client, to avoid locking issues. @@ -378,16 +377,8 @@ def startproject(project_name, directory): "Creates a Django project for the given project_name in the given directory." from random import choice _start_helper('project', project_name, directory) - # Populate TEMPLATE_DIRS for the admin templates, based on where Django is - # installed. - admin_settings_file = os.path.join(directory, project_name, 'settings', 'admin.py') - settings_contents = open(admin_settings_file, 'r').read() - fp = open(admin_settings_file, 'w') - settings_contents = re.sub(r'(?s)\b(TEMPLATE_DIRS\s*=\s*\()(.*?)\)', "\\1\n r%r,\\2)" % ADMIN_TEMPLATE_DIR, settings_contents) - fp.write(settings_contents) - fp.close() # Create a random SECRET_KEY hash, and put it in the main settings. - main_settings_file = os.path.join(directory, project_name, 'settings', 'main.py') + main_settings_file = os.path.join(directory, project_name, 'settings.py') settings_contents = open(main_settings_file, 'r').read() fp = open(main_settings_file, 'w') secret_key = ''.join([choice('abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)') for i in range(50)]) diff --git a/django/core/servers/basehttp.py b/django/core/servers/basehttp.py index e7d6b980324..2cb5471fe5d 100644 --- a/django/core/servers/basehttp.py +++ b/django/core/servers/basehttp.py @@ -602,7 +602,7 @@ class AdminMediaHandler: from django.conf import settings import django self.application = application - self.media_dir = django.__path__[0] + '/conf/admin_media' + self.media_dir = django.__path__[0] + '/contrib/admin/media' self.media_url = settings.ADMIN_MEDIA_PREFIX def __call__(self, environ, start_response): diff --git a/django/middleware/admin.py b/django/middleware/admin.py deleted file mode 100644 index 9c20cfc31c6..00000000000 --- a/django/middleware/admin.py +++ /dev/null @@ -1,126 +0,0 @@ -from django.utils import httpwrappers -from django.core.extensions import DjangoContext -from django.core.extensions import render_to_response -from django.models.auth import users -from django.views.registration import passwords -from django.views.auth.login import logout -import base64, md5 -import cPickle as pickle -from django.conf.settings import SECRET_KEY - -ERROR_MESSAGE = "Please enter a correct username and password. Note that both fields are case-sensitive." - -class AdminUserRequired: - """ - Admin middleware. If this is enabled, access to the site will be granted only - to valid users with the "is_staff" flag set. - """ - - def process_view(self, request, view_func, param_dict): - """ - Make sure the user is logged in and is a valid admin user before - allowing any access. - - Done at the view point because we need to know if we're running the - password reset function. - """ - - # If this is the password reset view, we don't want to require login - # Otherwise the password reset would need its own entry in the httpd - # conf, which is a little uglier than this. Same goes for the logout - # view. - - if view_func in (passwords.password_reset, passwords.password_reset_done, logout): - return - - assert hasattr(request, 'session'), "The admin requires session middleware to be installed. Edit your MIDDLEWARE_CLASSES setting to insert 'django.middleware.sessions.SessionMiddleware' before %r." % self.__class__.__name__ - - # Check for a logged in, valid user - if self.user_is_valid(request.user): - return - - # If this isn't already the login page, display it - if not request.POST.has_key('this_is_the_login_form'): - if request.POST: - message = "Please log in again, because your session has expired. "\ - "Don't worry: Your submission has been saved." - else: - message = "" - return self.display_login_form(request, message) - - # Check that the user accepts cookies. - if not request.session.test_cookie_worked(): - message = "Looks like your browser isn't configured to accept cookies. Please enable cookies, reload this page, and try again." - return self.display_login_form(request, message) - - # Check the password - username = request.POST.get('username', '') - try: - user = users.get_object(username__exact=username) - except users.UserDoesNotExist: - message = ERROR_MESSAGE - if '@' in username: - # Mistakenly entered e-mail address instead of username? Look it up. - try: - user = users.get_object(email__exact=username) - except users.UserDoesNotExist: - message = "Usernames cannot contain the '@' character." - else: - message = "Your e-mail address is not your username. Try '%s' instead." % user.username - return self.display_login_form(request, message) - - # The user data is correct; log in the user in and continue - else: - if self.authenticate_user(user, request.POST.get('password', '')): - request.session[users.SESSION_KEY] = user.id - if request.POST.has_key('post_data'): - post_data = decode_post_data(request.POST['post_data']) - if post_data and not post_data.has_key('this_is_the_login_form'): - # overwrite request.POST with the saved post_data, and continue - request.POST = post_data - request.user = user - return - else: - request.session.delete_test_cookie() - return httpwrappers.HttpResponseRedirect(request.path) - else: - return self.display_login_form(request, ERROR_MESSAGE) - - def display_login_form(self, request, error_message=''): - request.session.set_test_cookie() - if request.POST and request.POST.has_key('post_data'): - # User has failed login BUT has previously saved 'post_data' - post_data = request.POST['post_data'] - elif request.POST: - # User's session must have expired; save their post data - post_data = encode_post_data(request.POST) - else: - post_data = encode_post_data({}) - return render_to_response(self.get_login_template_name(), { - 'title': 'Log in', - 'app_path': request.path, - 'post_data': post_data, - 'error_message': error_message - }, context_instance=DjangoContext(request)) - - def authenticate_user(self, user, password): - return user.check_password(password) and user.is_staff - - def user_is_valid(self, user): - return not user.is_anonymous() and user.is_staff - - def get_login_template_name(self): - return "login" - -def encode_post_data(post_data): - pickled = pickle.dumps(post_data) - pickled_md5 = md5.new(pickled + SECRET_KEY).hexdigest() - return base64.encodestring(pickled + pickled_md5) - -def decode_post_data(encoded_data): - encoded_data = base64.decodestring(encoded_data) - pickled, tamper_check = encoded_data[:-32], encoded_data[-32:] - if md5.new(pickled + SECRET_KEY).hexdigest() != tamper_check: - from django.core.exceptions import SuspiciousOperation - raise SuspiciousOperation, "User may have tampered with session cookie." - return pickle.loads(pickled) diff --git a/django/models/auth.py b/django/models/auth.py index 20d846157ea..2a65290085c 100644 --- a/django/models/auth.py +++ b/django/models/auth.py @@ -176,49 +176,3 @@ class Message(meta.Model): def __repr__(self): return self.message - -class LogEntry(meta.Model): - action_time = meta.DateTimeField(auto_now=True) - user = meta.ForeignKey(User) - content_type = meta.ForeignKey(core.ContentType, blank=True, null=True) - object_id = meta.TextField(blank=True, null=True) - object_repr = meta.CharField(maxlength=200) - action_flag = meta.PositiveSmallIntegerField() - change_message = meta.TextField(blank=True) - class META: - module_name = 'log' - verbose_name_plural = 'log entries' - db_table = 'auth_admin_log' - ordering = ('-action_time',) - module_constants = { - 'ADDITION': 1, - 'CHANGE': 2, - 'DELETION': 3, - } - - def __repr__(self): - return str(self.action_time) - - def is_addition(self): - return self.action_flag == ADDITION - - def is_change(self): - return self.action_flag == CHANGE - - def is_deletion(self): - return self.action_flag == DELETION - - def get_edited_object(self): - "Returns the edited object represented by this log entry" - return self.get_content_type().get_object_for_this_type(pk=self.object_id) - - def get_admin_url(self): - """ - Returns the admin URL to edit the object represented by this log entry. - This is relative to the Django admin index page. - """ - return "%s/%s/%s/" % (self.get_content_type().package, self.get_content_type().python_module_name, self.object_id) - - def _module_log_action(user_id, content_type_id, object_id, object_repr, action_flag, change_message=''): - e = LogEntry(None, None, user_id, content_type_id, object_id, object_repr[:200], action_flag, change_message) - e.save() diff --git a/docs/django-admin.txt b/docs/django-admin.txt index 0faabbfcca1..ad7ee9d1373 100644 --- a/docs/django-admin.txt +++ b/docs/django-admin.txt @@ -192,10 +192,10 @@ Available options Example usage:: - django-admin.py init --settings='myproject.settings.main' + django-admin.py init --settings=myproject.settings Explicitly specifies the settings module to use. The settings module should be -in Python path syntax, e.g. "myproject.settings.main". If this isn't provided, +in Python path syntax, e.g. "myproject.settings". If this isn't provided, ``django-admin.py`` will use the DJANGO_SETTINGS_MODULE environment variable. --pythonpath diff --git a/docs/faq.txt b/docs/faq.txt index 712f7b26a8c..062bce730ba 100644 --- a/docs/faq.txt +++ b/docs/faq.txt @@ -348,8 +348,7 @@ things: * Set the ``SESSION_COOKIE_DOMAIN`` setting in your admin config file to match your domain. For example, if you're going to "http://www.mysite.com/admin/" in your browser, in - "myproject.settings.admin" you should set ``SESSION_COOKIE_DOMAIN = - 'www.mysite.com'``. + "myproject.settings" you should set ``SESSION_COOKIE_DOMAIN = 'www.mysite.com'``. * Some browsers (Firefox?) don't like to accept cookies from domains that don't have dots in them. If you're running the admin site on "localhost" diff --git a/docs/middleware.txt b/docs/middleware.txt index 33cb1a38e45..d920e883707 100644 --- a/docs/middleware.txt +++ b/docs/middleware.txt @@ -27,30 +27,15 @@ name. For example, here's the default ``MIDDLEWARE_CLASSES`` created by "django.middleware.doc.XViewMiddleware", ) -The default admin site has the following ``MIDDLEWARE_CLASSES`` set:: - - MIDDLEWARE_CLASSES = ( - "django.middleware.sessions.SessionMiddleware", - "django.middleware.admin.AdminUserRequired", - "django.middleware.common.CommonMiddleware", - ) - Django applies middleware in the order it's defined in ``MIDDLEWARE_CLASSES``. -For a regular (i.e., non-admin) Django installation, no middleware is required, -but it's strongly suggested that you use ``CommonMiddleware``. For a Django -admin site, ``SessionMiddleware`` and ``AdminUserRequired`` (in that order) are -required. +A Django installation doesn't require any middleware -- e.g., +``MIDDLEWARE_CLASSES`` can be empty, if you'd like -- but it's strongly +suggested that you use ``CommonMiddleware``. Available middleware ==================== -django.middleware.admin.AdminUserRequired ------------------------------------------ - -Limits site access to valid users with the ``is_staff`` flag set. This is -required by Django's admin, and this middleware requires ``SessionMiddleware``. - django.middleware.cache.CacheMiddleware --------------------------------------- diff --git a/docs/modpython.txt b/docs/modpython.txt index d24ea29018a..13377ad2dd3 100644 --- a/docs/modpython.txt +++ b/docs/modpython.txt @@ -25,12 +25,11 @@ Then edit your ``httpd.conf`` file and add the following::