Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Table 'XYZ.fakemlng_translations' doesn't exist" #2142

Open
stevenbouma opened this Issue · 4 comments

4 participants

@stevenbouma

Received this very weird exception when using a PlaceholderFIeld outside django-cms (in custom models)

removing (commenting) the FakemlngFixtures class from django-cms / cms / test_utils / fixtures / fakemlng.py, was a quick fix that works for now.

Exception thrown here, lib/python2.7/site-packages/cms/models/placeholdermodel.py in _get_attached_field

field = getattr(self, rel.get_accessor_name())
if field.count():

@yakky
Collaborator

What's your INSTALLED_APPS setup?

@yakky yakky was assigned
@RRMoelker

Working on same project as OP.

After a virtual environment reinstall, the problem disappeared. But it is back again after updating packages. For now we've quick fixed the problem.

Problem occurs when using django-cms "PlaceholderField" in our models. When editing the model in the admin, the placeholderfield widget is loaded and ".fakemlng_translations" table does not exist problem arises.

The critical part of the stack trace is below. Starting from the widget.py to the queryset method which throws the exception that the "fakemlng_translations" table doesn't exists.


File "/webapps/.virtualenvs/python2/local/lib/python2.7/site-packages/cms/forms/widgets.py", line 204, in render
if ph.actions.can_copy:

File "/webapps/.virtualenvs/python2/local/lib/python2.7/site-packages/cms/models/placeholdermodel.py", line 152, in actions
field = self._get_attached_field()

File "/webapps/.virtualenvs/python2/local/lib/python2.7/site-packages/cms/models/placeholdermodel.py", line 107, in _get_attached_field
if field.count():


The problem I think lies in the "_get_attached_fields" method where "self._meta.get_all_related_objects" is called. All attached models are then queried which is fine for our custom models with the "PlaceholderField". However in the cms folder there is a model only used for testing.

The test model is "cms/test_utils/project/fakemlng/models.py: Translations". The table for this model only seems to be created when running test and not when using simple syncdb and migrate commands. But it is related by django at runtime to the placeholder model and so produces the problem. The "pythonpath" environmental variable is set to the "site-packages" folder which may cause django to recognize the related test model.

The quick fix was once again commenting "Translations" model in "test_utils/project/fakemlng/models.py".

Coming back to the question of the INSTALLED_APPS. Given that the problem is already pinpointed I hope only listing the django and cms versions is enough:
Django==1.5.5
django-cms==2.4.3

@digi604
Collaborator

So how does django find this model?

@RRMoelker

It seems to be loaded by the wsgi module of apache. The python path points to the project root and site packages inside a virtual environment. That is:
WSGIPythonPath //local/lib/python2.7/site-packages

When running the benign functions through the shell I don't get the errors. Indicating that only the wsgi module has the cms test language model loaded.

Seems the WSGIPythonPath setup in combination with having "cms" as an installed app is causing all this. But it seems like a valid setup.

@digi604 digi604 modified the milestone: 3.0, 2.4.X
@yakky yakky removed their assignment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.