Since Django 1.5 we have the [ResolverMatch](https://docs.djangoproject.com/en/dev/ref/urlresolvers/#django.core.urlresolvers.ResolverMatch) which gives us the namespace. 

So we can do: 

    try: 
        namespace = request.resolver_match.namespace
    except AttributeError: # this is right yes? 
        ...