Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migration fails to load models - Django 1.8.5 Django-CMS 3.1 #98

Open
source3 opened this issue Oct 15, 2015 · 4 comments
Open

Migration fails to load models - Django 1.8.5 Django-CMS 3.1 #98

source3 opened this issue Oct 15, 2015 · 4 comments

Comments

@source3
Copy link

source3 commented Oct 15, 2015

The following error occurs running 'python manage.py migrate'. Upgrading from Django 1.5/django-cms 2.4. I tired migrating from south as explained in https://docs.djangoproject.com/en/1.8/topics/migrations/#upgrading-from-south and https://docs.djangoproject.com/en/1.8/topics/migrations/#libraries-third-party-apps. Did not work. Same error.

Any suggestions or solutions is much appreciated.

Traceback (most recent call last):
File "manage.py", line 10, in
execute_from_command_line(sys.argv)
File "/ebs/localdealsmagazine/local/lib/python2.7/site-packages/django/core/management/init.py", line 351, in execute_from_command_line
utility.execute()
File "/ebs/localdealsmagazine/local/lib/python2.7/site-packages/django/core/management/init.py", line 325, in execute
django.setup()
File "/ebs/localdealsmagazine/local/lib/python2.7/site-packages/django/init.py", line 18, in setup
apps.populate(settings.INSTALLED_APPS)
File "/ebs/localdealsmagazine/local/lib/python2.7/site-packages/django/apps/registry.py", line 108, in populate
app_config.import_models(all_models)
File "/ebs/localdealsmagazine/local/lib/python2.7/site-packages/django/apps/config.py", line 198, in import_models
self.models_module = import_module(models_module_name)
File "/usr/lib/python2.7/importlib/init.py", line 37, in import_module
import(name)
File "/ebs/localdealsmagazine/local/lib/python2.7/site-packages/form_designer/contrib/cms_plugins/form_designer_form/models.py", line 1, in
from form_designer.models import FormDefinition
File "/ebs/localdealsmagazine/local/lib/python2.7/site-packages/form_designer/models.py", line 19, in
User = get_user_model()
File "/ebs/localdealsmagazine/local/lib/python2.7/site-packages/django/contrib/auth/init.py", line 150, in get_user_model
return django_apps.get_model(settings.AUTH_USER_MODEL)
File "/ebs/localdealsmagazine/local/lib/python2.7/site-packages/django/apps/registry.py", line 199, in get_model
self.check_models_ready()
File "/ebs/localdealsmagazine/local/lib/python2.7/site-packages/django/apps/registry.py", line 131, in check_models_ready
raise AppRegistryNotReady("Models aren't loaded yet.")
django.core.exceptions.AppRegistryNotReady: Models aren't loaded yet.

settings.py:
INSTALLED_APPS = (
...
'picklefield',
'form_designer.contrib.cms_plugins.form_designer_form',
'form_designer',
...
)

MIDDLEWARE_CLASSES = (
...
'form_designer.middleware.RedirectMiddleware',
)

@source3
Copy link
Author

source3 commented Oct 15, 2015

Fixed. Warning, I have not fully tested the fix below.

Django 1.8

  • uses ugettext_lazy not ugettext. Replaced all occurances of ugettext with ugettext_lazy in cms_plugins.py, settings.py, forms.py, models.py, admin.py, and views.py
  • replaced get_user_model with auth_user_model in models.py
  • ModelForm requires either 'fields' or 'exclude' in the meta. Added fields = 'all' in forms.py where two classes subclass from ModelForm.
  • removed the middleware class as shown above.
  • Copied ../migrations to ../migrations_south. Then removed all files excecpt '_ init.py _' in the migrations folder.

Then ran 'python mange.py makemigrations' then 'python migrate.py form_designer'.

I submitted patches for the above files. Not to good with github so I hope I proposed the changes correctly.

@andreav
Copy link

andreav commented Dec 7, 2015

Same here.
Django==1.8.7 + django-cms==3.2.0

Any chance the patch will be merged?
Thanks.

@theblackcat102
Copy link

Same here, Please merge the patch as soon as possible

@barseghyanartur
Copy link

Guys, seriously, don't you see the project is dead? Last commit has been done about 3 years ago (same goes for the last issue closed). Either (1) fork and register on PyPI under different name or (2) switch to another package.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants