1
0
mirror of https://github.com/django/django.git synced 2025-10-23 21:59:11 +00:00

[1.7.x] Refs #23276: Removed bad examples of passing views as strings to url()

partial backport of a9fd740d22 from master
This commit is contained in:
Collin Anderson
2014-08-12 14:12:50 -04:00
parent 49419ffd05
commit 8f9dd9f256
5 changed files with 141 additions and 110 deletions

View File

@@ -186,10 +186,12 @@ example above::
from django.conf.urls import patterns
from . import views
urlpatterns = patterns('',
(r'^articles/(\d{4})/$', 'news.views.year_archive'),
(r'^articles/(\d{4})/(\d{2})/$', 'news.views.month_archive'),
(r'^articles/(\d{4})/(\d{2})/(\d+)/$', 'news.views.article_detail'),
(r'^articles/(\d{4})/$', views.year_archive),
(r'^articles/(\d{4})/(\d{2})/$', views.month_archive),
(r'^articles/(\d{4})/(\d{2})/(\d+)/$', views.article_detail),
)
The code above maps URLs, as simple `regular expressions`_, to the location of