bernardopires / django-tenant-schemas

Tenant support for Django using PostgreSQL schemas.
https://django-tenant-schemas.readthedocs.org/en/latest/
MIT License
1.45k stars 424 forks source link

Set URL conf for PUBLIC_SCHEMA_URLCONF to avoid URL pattern duplication #604

Open jibusayone opened 5 years ago

jibusayone commented 5 years ago

In the docs, it's said that if we want the user to be routed to different views when someone requests http://example.com/ and http://customer.example.com/, we can specify that URL pattern in the PUBLIC_SCHEMA_URLCONF file.

But if we want certain views to be available only when requested from public schema, currently we have to have those patterns in both PUBLIC_SCHEMA_URLCONF and ROOT_URLCONF files. And I had to then raise django.views.defaults.page_not_found on the ROOT_URLCONF pattern.

To fix this duplicate pattern issue, I had to add set_urlconf(request.urlconf) in the middleware.

Nicolas-Coeficiente commented 4 years ago

i'm using django-tenants, how can i request the same commit for it? django-tenants it's a fork of django-tenant-schemas.