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
Swapped User logic incorrect in Django 1.7 #3436
Comments
DJANGO_1_6 means 1.6 and lower. |
This seems to be affecting me. When running manage.py validate and various other management commands, I get the below traceback. This only happens on Django 1.7. I downgraded to 1.6.6 and everything is peachy. I tested with fresh databases and identical settings between both versions. Haven't had time to debug further, but thought this could be helpful for others (since I didn't see any other tickets on it). $ python manage.py validate /home/flyweb/www/venv/lib/python3.4/site-packages/cms/publisher/manager.py:5: RemovedInDjango18Warning: /home/flyweb/www/venv/lib/python3.4/site-packages/cms/models/managers.py:15: RemovedInDjango18Warning: Traceback (most recent call last): |
I got this error as well. Have you tried moving your
Once the initial migration was created, I could then re-enable the default cms apps in INSTALLED_APPS and then |
@jesselegg, @kevingill1966 As stated in http://django-cms.readthedocs.org/en/latest/basic_reference/configuration.html#custom-user-requirements the custom user model application must be declared before |
@yakky My custom user does not depend on cms models in any way. If I have the basic cms apps listed in INSTALLED_APPS, I can't create the initial migration for my custom User model (even though it is listed before 'cms'). When I do
If I temporarily comment out the cms apps from INSTALLED_SETTINGS, I can create the initial migration, then uncomment the cms apps and run the full I am running the latest from the |
Not really: that error is generated by the migrations code when it cannot find a migrated model related to the errored model. |
It's a fairly standard custom user which uses email instead of username, here's a gist. I totally get why there would be an error if I tried to apply the CMS migrations without migrating the custom user first since there is an obvious dependency there, it's just unclear why I can't |
Thanks for the gist. |
I've created a minimal app to reproduce https://github.com/jsma/cmstest |
Awesome! |
The provided example has an empty migrations directory which prevents migrations to be created for the |
It works as you say. Strange to me that the presence of the folder but no actual migration files would make it break. But I guess that's an issue to take upstream. Thanks for looking into it. |
Actually, if I comment out all CMS related stuff from settings, I can create the initial migration just fine, so this does not appear to be an upstream issue. In fact, |
In the end it all depends on this behavior: https://github.com/django/django/blob/stable/1.7.x/django/db/migrations/loader.py#L71 |
Opened on Django tracker: https://code.djangoproject.com/ticket/23599 |
As stated at https://code.djangoproject.com/ticket/23599#comment:6 and at https://docs.djangoproject.com/en/1.7/topics/auth/customizing/#substituting-a-custom-user-model creating migration for custom user models should be done in isolation before dependent applications step in to avoid dependency issues. |
Well, until now, i have this issue and i can't continue with my develop. Good, first i migrated all apps without cms, them, cms, and works. |
Moved mentioned migration-models
from original origin in file
to initial file:
and did a sqlmigrate on both files (sqlmigrate cms 0001_initial & sqlmigrate cms 0002_auto_20140816_1918). Works like a charm without any more modifications! At https://docs.djangoproject.com/en/1.7/topics/auth/customizing/#substituting-a-custom-user-model its described that:
"PageUserGroup" and "PagePermission" access "AUTH_USER_MODEL" thats the reason why they need to be moved to 0001_initial.py file. |
in permissionmodels.py there is a piece of logic to determine if the user is swapped. There are two paths through the code, one for Django 1.6 and one for other versions of Django. The wrong branch is taken in Django 1.7. The logic should, in my opinion be,
if DJANGO_1_6 or DJANGO_1_7:
and DJANGO_1_7 should be imported at the top.
The text was updated successfully, but these errors were encountered: