diff options
| author | Adrian Holovaty <adrian@holovaty.com> | 2010-10-06 22:55:06 +0000 |
|---|---|---|
| committer | Adrian Holovaty <adrian@holovaty.com> | 2010-10-06 22:55:06 +0000 |
| commit | 47cae1a2f6008382229b985f160846a7083726b6 (patch) | |
| tree | 46e74603c7ccc34215caa1d2aa639bad9833665c | |
| parent | 40765f1bdd6b4fc1a21ab38c2816a2fcc45618b0 (diff) | |
Fixed #14414 -- Improved contenttypes shortcut() view to check that the ContentType has a model_class(). Thanks, subsume
git-svn-id: http://code.djangoproject.com/svn/django/trunk@13994 bcc190cf-cafb-0310-a4f2-bffc1f526a37
| -rw-r--r-- | django/contrib/contenttypes/views.py | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/django/contrib/contenttypes/views.py b/django/contrib/contenttypes/views.py index ba82564974..ac0feffe7a 100644 --- a/django/contrib/contenttypes/views.py +++ b/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)) |
