Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[1.2.X] Fixed #14414 -- Improved contenttypes shortcut() view to chec…

…k that the ContentType has a model_class(). Thanks, subsume

Backport of r13994 from trunk.

git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.2.X@14385 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 181f26428abf3679e2b747fd49b88b0f104918f2 1 parent c120794
@freakboy3742 freakboy3742 authored
Showing with 2 additions and 0 deletions.
  1. +2 −0  django/contrib/contenttypes/views.py
View
2  django/contrib/contenttypes/views.py
@@ -8,6 +8,8 @@ def shortcut(request, content_type_id, object_id):
# Look up the object, making sure it's got a get_absolute_url() function.
try:
content_type = ContentType.objects.get(pk=content_type_id)
+ if not content_type.model_class():
+ raise http.Http404("Content type %s object has no associated model" % content_type_id)
obj = content_type.get_object_for_this_type(pk=object_id)
except (ObjectDoesNotExist, ValueError):
raise http.Http404("Content type %s object %s doesn't exist" % (content_type_id, object_id))
Please sign in to comment.
Something went wrong with that request. Please try again.