Author: russellm
Date: 2010-10-28 07:16:21 -0500 (Thu, 28 Oct 2010)
New Revision: 14385
Modified:
django/branches/releases/1.2.X/django/contrib/contenttypes/views.py
Log:
[1.2.X] Fixed #14414 -- Improved contenttypes shortcut() view to check that the
ContentType has a model_class(). Thanks, subsume
Backport of r13994 from trunk.
Modified: django/branches/releases/1.2.X/django/contrib/contenttypes/views.py
===================================================================
--- django/branches/releases/1.2.X/django/contrib/contenttypes/views.py
2010-10-28 12:16:04 UTC (rev 14384)
+++ django/branches/releases/1.2.X/django/contrib/contenttypes/views.py
2010-10-28 12:16:21 UTC (rev 14385)
@@ -8,6 +8,8 @@
# 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))
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en.