Last active
December 28, 2015 14:59
-
-
Save victorono/7519093 to your computer and use it in GitHub Desktop.
Show page 404 for register not found django
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def not_found(method): | |
def wrap(*args, **kwargs): | |
from django.core.exceptions import ObjectDoesNotExist | |
from django.http import Http404 | |
try: | |
return method(*args, **kwargs) | |
except ObjectDoesNotExist, ex: | |
raise Http404(ex.message) | |
return wrap |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment