Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed #14414 -- Improved contenttypes shortcut() view to check that t…

…he ContentType has a model_class(). Thanks, subsume

git-svn-id: http://code.djangoproject.com/svn/django/trunk@13994 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 47cae1a2f6008382229b985f160846a7083726b6 1 parent 40765f1
Adrian Holovaty authored

Showing 1 changed file with 2 additions and 0 deletions. Show diff stats Hide diff stats

  1. 2  django/contrib/contenttypes/views.py
2  django/contrib/contenttypes/views.py
@@ -8,6 +8,8 @@ def shortcut(request, content_type_id, object_id):
8 8
     # Look up the object, making sure it's got a get_absolute_url() function.
9 9
     try:
10 10
         content_type = ContentType.objects.get(pk=content_type_id)
  11
+        if not content_type.model_class():
  12
+            raise http.Http404("Content type %s object has no associated model" % content_type_id)
11 13
         obj = content_type.get_object_for_this_type(pk=object_id)
12 14
     except (ObjectDoesNotExist, ValueError):
13 15
         raise http.Http404("Content type %s object %s doesn't exist" % (content_type_id, object_id))

0 notes on commit 47cae1a

Please sign in to comment.
Something went wrong with that request. Please try again.