def map_project_slug(view_func):
 @wraps(view_func)
 def inner_view(request, project=None, project_slug=None, *args, **kwargs):
  if (project is None):
   if (not project_slug):
    project_slug = request.slug
   try:
    project = Project.objects.get(slug=project_slug)
   except Project.DoesNotExist:
    raise Http404('Project does not exist.')
  return view_func(request, project=project, *args, **kwargs)
 return inner_view

def map_project_slug ( view_func ) : @ wraps ( view_func ) def inner_view ( request , project = None , project_slug = None , * args , ** kwargs ) : if ( project is None ) : if ( not project_slug ) : project_slug = request . slug try : project = Project . objects . get ( slug = project_slug ) except Project . DoesNotExist : raise Http404 ( 'Project does not exist.' ) return view_func ( request , project = project , * args , ** kwargs ) return inner_view
a decorator that maps a project_slug url param into a project .