Skip to content

Commit

Permalink
Merge pull request #159 from ixc/object-does-not-exist
Browse files Browse the repository at this point in the history
Raise Http404 if object does not exist.
  • Loading branch information
vdboor committed Oct 1, 2015
2 parents 670b2be + bcc39a9 commit f4898c3
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion polymorphic/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,11 @@ def get_child_type_choices(self, request, action):


def _get_real_admin(self, object_id):
obj = self.model.objects.non_polymorphic().values('polymorphic_ctype').get(pk=object_id)
try:
obj = self.model.objects.non_polymorphic() \
.values('polymorphic_ctype').get(pk=object_id)
except self.model.DoesNotExist:
raise Http404
return self._get_real_admin_by_ct(obj['polymorphic_ctype'])


Expand Down

0 comments on commit f4898c3

Please sign in to comment.