summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
authorAymeric Augustin <aymeric.augustin@m4x.org>2013-03-14 20:28:24 +0100
committerAymeric Augustin <aymeric.augustin@m4x.org>2013-03-14 20:30:23 +0100
commit3f2befc93163e0666dcc4f745288b98306de4b8e (patch)
treeecca16348da0fab7c87bba937090aef498c9ff2f /django
parent2f121dfe635b3f497fe1fe03bc8eb97cdf5083b3 (diff)
Deprecated django.views.defaults.shortcut.
Diffstat (limited to 'django')
-rw-r--r--django/conf/urls/shortcut.py5
-rw-r--r--django/views/defaults.py13
2 files changed, 11 insertions, 7 deletions
diff --git a/django/conf/urls/shortcut.py b/django/conf/urls/shortcut.py
index 6eb2e55e68..c00d176ad6 100644
--- a/django/conf/urls/shortcut.py
+++ b/django/conf/urls/shortcut.py
@@ -1,5 +1,10 @@
+import warnings
+
from django.conf.urls import patterns
+warnings.warn("django.conf.urls.shortcut will be removed in Django 1.8.",
+ PendingDeprecationWarning)
+
urlpatterns = patterns('django.views',
(r'^(?P<content_type_id>\d+)/(?P<object_id>.*)/$', 'defaults.shortcut'),
)
diff --git a/django/views/defaults.py b/django/views/defaults.py
index ec7a233ff7..89228c50c9 100644
--- a/django/views/defaults.py
+++ b/django/views/defaults.py
@@ -1,3 +1,5 @@
+import warnings
+
from django import http
from django.template import (Context, RequestContext,
loader, Template, TemplateDoesNotExist)
@@ -63,12 +65,9 @@ def permission_denied(request, template_name='403.html'):
def shortcut(request, content_type_id, object_id):
- # TODO: Remove this in Django 2.0.
- # This is a legacy view that depends on the contenttypes framework.
- # The core logic was moved to django.contrib.contenttypes.views after
- # Django 1.0, but this remains here for backwards compatibility.
- # Note that the import is *within* this function, rather than being at
- # module level, because we don't want to assume people have contenttypes
- # installed.
+ warnings.warn(
+ "django.views.defaults.shortcut will be removed in Django 1.8. "
+ "Import it from django.contrib.contenttypes.views instead.",
+ PendingDeprecationWarning, stacklevel=2)
from django.contrib.contenttypes.views import shortcut as real_shortcut
return real_shortcut(request, content_type_id, object_id)