Hi,
I have installed Wagtail and the separation works well - in pages, in import of images and documents, while displaying the published page (like tenant1.localhost:8000/mypage).
However if I add a picture into richtext (means: I defined an easy page with wagtail.core.fields.RichTextField), then in Preview (regardless if during editation or on a saved Draft),
ie. on url like tenant1.localhost:8000/admin/pages/4/edit/preview/
the picture is missing, just <img alt=""> is generated.
I have found a place in Wagtail, wagtail/core/rich_text/__init__.py, EntityHandler, get_instance method.
If I do there:
from django.db import connection
then I see:
connection.schema_name # public, but it should be tenant1.
When I assign in that place
connection.schema_name = 'tenant1'
and resume, the pictures appear properly.
That means Wagtail+TenantSchemas search for pictures inside other schema (public).
I could participate in this, however need help or idea where the proper .schema_name should be (in django-tenant-schemas) assigned.
Settings are:
TENANT_MODEL = "schemas_customers.Client"
TENANT_APPS = [
'django.contrib.contenttypes',
# your tenant-specific apps
'home',
'search',
'wagtail.contrib.forms',
'wagtail.contrib.redirects',
'wagtail.embeds',
'wagtail.sites',
'wagtail.users',
'wagtail.snippets',
'wagtail.documents',
'wagtail.images',
'wagtail.search',
'wagtail.admin',
'wagtail.core',
'modelcluster',
'taggit',
]
SHARED_APPS = [
'tenant_schemas', # mandatory, should always be before any django app
'schemas_customers', # you must list the app where your tenant model resides in
] + TENANT_APPS + [
#'django.contrib.contenttypes', # would be duplicate if we add TENANT_APPS
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
]
INSTALLED_APPS = [
'tenant_schemas', # mandatory, should always be before any django app
'schemas_customers',
'home', # into HomePage I added wagtail.core.fields.RichTextField
'search',
'wagtail.contrib.forms',
'wagtail.contrib.redirects',
'wagtail.embeds',
'wagtail.sites',
'wagtail.users',
'wagtail.snippets',
'wagtail.documents',
'wagtail.images',
'wagtail.search',
'wagtail.admin',
'wagtail.core',
'modelcluster',
'taggit',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
]
I'm sorry.
The problem was in Wagtail default settings. Wagtail autmatically creates a Site setting localhost:80 which need be changed to tenant1.localhost:8000 to work properly.
Hi, I have installed Wagtail and the separation works well - in pages, in import of images and documents, while displaying the published page (like
tenant1.localhost:8000/mypage
).However if I add a picture into richtext (means: I defined an easy page with wagtail.core.fields.RichTextField), then in Preview (regardless if during editation or on a saved Draft), ie. on url like
tenant1.localhost:8000/admin/pages/4/edit/preview/
the picture is missing, just<img alt="">
is generated.I have found a place in Wagtail,
wagtail/core/rich_text/__init__.py
, EntityHandler, get_instance method. If I do there:from django.db import connection
then I see:connection.schema_name
# public, but it should be tenant1. When I assign in that placeconnection.schema_name = 'tenant1'
and resume, the pictures appear properly.That means Wagtail+TenantSchemas search for pictures inside other schema (public).
I could participate in this, however need help or idea where the proper .schema_name should be (in django-tenant-schemas) assigned.
Settings are: