From 5fe9b7b40acf73da3dd91c56b3534f0bab1fb3d0 Mon Sep 17 00:00:00 2001 From: Timothy Allen Date: Mon, 7 Aug 2017 10:33:55 -0400 Subject: [PATCH] Fixed #28457 -- Updated the design of the 'Congrats' page for new Django projects. Developed by Timothy Allen and Chad Whitman of The Wharton School with shepherding from Aymeric Augustin and Collin Anderson. --- AUTHORS | 2 + django/views/debug.py | 18 +- django/views/templates/default_urlconf.html | 477 ++++++++++++++++++-- docs/intro/tutorial01.txt | 2 +- tests/view_tests/tests/test_debug.py | 2 +- 5 files changed, 443 insertions(+), 58 deletions(-) diff --git a/AUTHORS b/AUTHORS index ec21ed5795..8fbf94582c 100644 --- a/AUTHORS +++ b/AUTHORS @@ -146,6 +146,7 @@ answer newbie questions, and generally made Django that much better: Carlos Matías de la Torre Carlton Gibson cedric@terramater.net + Chad Whitman ChaosKCW Charlie Leifer charly.wilhelm@gmail.com @@ -764,6 +765,7 @@ answer newbie questions, and generally made Django that much better: Thomas Stromberg Thomas Tanner tibimicu@gmx.net + Tim Allen Tim Graham Tim Heap Tim Saylor diff --git a/django/views/debug.py b/django/views/debug.py index 15566a25cd..9823b7dd8c 100644 --- a/django/views/debug.py +++ b/django/views/debug.py @@ -14,13 +14,16 @@ from django.utils import timezone from django.utils.datastructures import MultiValueDict from django.utils.encoding import force_text from django.utils.module_loading import import_string -from django.utils.translation import gettext as _ +from django.utils.version import get_docs_version # Minimal Django templates engine to render the error templates # regardless of the project's TEMPLATES setting. Templates are # read directly from the filesystem so that the error handler # works even if the template loader is broken. -DEBUG_ENGINE = Engine(debug=True) +DEBUG_ENGINE = Engine( + debug=True, + libraries={'i18n': 'django.templatetags.i18n'}, +) HIDDEN_SETTINGS = re.compile('API|TOKEN|KEY|SECRET|PASS|SIGNATURE', flags=re.IGNORECASE) @@ -504,16 +507,7 @@ def default_urlconf(request): with Path(CURRENT_DIR, 'templates', 'default_urlconf.html').open() as fh: t = DEBUG_ENGINE.from_string(fh.read()) c = Context({ - "title": _("Welcome to Django"), - "heading": _("It worked!"), - "subheading": _("Congratulations on your first Django-powered page."), - "instructions": _( - "Next, start your first app by running python manage.py startapp [app_label]." - ), - "explanation": _( - "You're seeing this message because you have DEBUG = True in your " - "Django settings file and you haven't configured any URLs. Get to work!" - ), + 'version': get_docs_version(), }) return HttpResponse(t.render(c), content_type='text/html') diff --git a/django/views/templates/default_urlconf.html b/django/views/templates/default_urlconf.html index f080a4ea29..65d07bd021 100644 --- a/django/views/templates/default_urlconf.html +++ b/django/views/templates/default_urlconf.html @@ -1,44 +1,433 @@ - - - - {{ title }} - - - - -
-

{{ heading }}

-

{{ subheading }}

-
- -
-

{{ instructions|safe }}

-
- -
-

{{ explanation|safe }}

-
- +{% load i18n %} + + + + + {% trans "Django: the Web framework for perfectionists with deadlines." %} + + + + + +
+ +
+

{% blocktrans %}View release notes for Django {{ version }}{% endblocktrans %}

+
+
+
+
+ + + + + + + + + + + + + + + + +
+

{% trans "The install worked successfully! Congratulations!" %}

+

{% blocktrans %}You are seeing this page because DEBUG=True is in your settings file and have not configured any URLs.{% endblocktrans %}

+
+ + + diff --git a/docs/intro/tutorial01.txt b/docs/intro/tutorial01.txt index a83f24e4a1..aef9a1e66f 100644 --- a/docs/intro/tutorial01.txt +++ b/docs/intro/tutorial01.txt @@ -157,7 +157,7 @@ production environment. It's intended only for use while developing. (We're in the business of making Web frameworks, not Web servers.) Now that the server's running, visit http://127.0.0.1:8000/ with your Web -browser. You'll see a "Welcome to Django" page, in pleasant, light-blue pastel. +browser. You'll see a "Congratulations!" page, with a rocket taking off. It worked! .. admonition:: Changing the port diff --git a/tests/view_tests/tests/test_debug.py b/tests/view_tests/tests/test_debug.py index bb354a5cb6..a260f948e5 100644 --- a/tests/view_tests/tests/test_debug.py +++ b/tests/view_tests/tests/test_debug.py @@ -195,7 +195,7 @@ class DebugViewTests(LoggingCaptureMixin, SimpleTestCase): response = self.client.get('/') self.assertContains( response, - "

Congratulations on your first Django-powered page.

" + "

The install worked successfully! Congratulations!

" ) @override_settings(ROOT_URLCONF='view_tests.regression_21530_urls')