From b1d83209d0a0df698e66d1cb5fa2a87b9859c3ed Mon Sep 17 00:00:00 2001 From: Andrew Pinkham Date: Mon, 13 Apr 2015 12:17:38 -0400 Subject: [PATCH] [1.8.x] Fixed #24635 -- Updated deprecated urls.py examples in default project template. Backport of 0b5abb03218ff0c575cee0c83e446bab81cbfadd from master --- .../project_template/project_name/urls.py | 19 +++++++++++++++---- docs/releases/1.8.1.txt | 5 +++++ 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/django/conf/project_template/project_name/urls.py b/django/conf/project_template/project_name/urls.py index 308d0b4d33..665085b17b 100644 --- a/django/conf/project_template/project_name/urls.py +++ b/django/conf/project_template/project_name/urls.py @@ -1,10 +1,21 @@ +"""{{ project_name }} URL Configuration + +The `urlpatterns` list routes URLs to views. For more information please see: + https://docs.djangoproject.com/en/{{ docs_version }}/topics/http/urls/ +Examples: +Function views + 1. Add an import: from my_app import views + 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') +Class-based views + 1. Add an import: from other_app.views import Home + 2. Add a URL to urlpatterns: url(r'^$', Home.as_view(), name='home') +Including another URLconf + 1. Add an import: from blog import urls as blog_urls + 2. Add a URL to urlpatterns: url(r'^blog/', include(blog_urls)) +""" from django.conf.urls import include, url from django.contrib import admin urlpatterns = [ - # Examples: - # url(r'^$', '{{ project_name }}.views.home', name='home'), - # url(r'^blog/', include('blog.urls')), - url(r'^admin/', include(admin.site.urls)), ] diff --git a/docs/releases/1.8.1.txt b/docs/releases/1.8.1.txt index 9d7c5add38..fd2140bbf0 100644 --- a/docs/releases/1.8.1.txt +++ b/docs/releases/1.8.1.txt @@ -44,3 +44,8 @@ Bugfixes * Fixed database introspection with SQLite 3.8.9 (released April 8, 2015) (:ticket:`24637`). + +* Updated ``urlpatterns`` examples generated by :djadmin:`startproject` to + remove usage of referencing views by dotted path in + :func:`~django.conf.urls.url` which is deprecated in Django 1.8 + (:ticket:`24635`).