Skip to content

Instantly share code, notes, and snippets.

def get_object_or_404(klass, *args, **kwargs):
try:
return queryset.get(*args, **kwargs)
except queryset.model.DoesNotExist:
raise Http404('No %s matches the given query.' % queryset.model._meta.object_name)
def get_object_or_404(klass, *args, **kwargs):
queryset = _get_queryset(klass)
try:
return queryset.get(*args, **kwargs)
except queryset.model.DoesNotExist:
raise Http404('No %s matches the given query.' % queryset.model._meta.object_name)
@imownbey
imownbey / gist:128
Created July 21, 2008 20:31 — forked from maddox/gist:119
def what_is_gist
"A bad ass version-able pastebin"
This is sorta cool I guess?
end