Corrected docs on router include with namespaces. by carltongibson · Pull Request #5843 · encode/django-rest-framework (original) (raw)

The parenthesis is missing. I'll fix that.

SO... 😃

What ultimately gets passed included is a 3-tuple:

(A_LIST_OF_PATTERNS, AN_APPLICATION_NAMESPACE, AN_INSTANCE_NAMESPACE)

In the example here we pass the first two of those, as a 2-tuple.

When you include a module the list of patterns comes from urlpatterns, and the application namespace comes from app_name.

I've just used app_name here as any old string. It's usually, 'admin', or 'polls' or 'rest_framework'.

In this example the instance namespace ends up being the same as the application namespace, because we didn't provide one. (This means that it'll be None if the application namespace is, which is just the global namespace we all start out with.)

But we could do provide, say, namespace='v1' and such.

Grrr. I'm still not happy here.