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

MongoEngine compability #37

Closed
Diolor opened this issue Sep 22, 2013 · 6 comments
Closed

MongoEngine compability #37

Diolor opened this issue Sep 22, 2013 · 6 comments

Comments

@Diolor
Copy link

Diolor commented Sep 22, 2013

When I try to setup the library with the mongoengine it fails with a ImportError: No module named auth.

I have explained the problem in stackoverflow, here .

Is it a compatibility bug or have I missed something? Thanks

@omab
Copy link
Owner

omab commented Sep 22, 2013

Which version of mongoengine? What happens when you try this on a django-shell:

from mongoengine.django.auth import User

or:

from social.utils import module_member
print module_member('mongoengine.django.auth.User')

@omab
Copy link
Owner

omab commented Sep 22, 2013

Was trying this my self and seems that the default value for AUTH_USER_MODEL is causing errors, the default value is auth.User which refs to django.contrib.auth.models.User. But defining it to mongoengine.django.auth.User django complains about the format not being app_name.ModelName, defining SOCIAL_AUTH_USER_MODEL = 'mongoengine.django.auth.User' solves the issue.

@Diolor
Copy link
Author

Diolor commented Sep 23, 2013

My mongoengine is 0.8.4. I also saw your comment on stackoverflow, thanks.

I don't get any error neither on

from mongoengine.django.auth import User

nor with

from social.utils import module_member
print module_member('mongoengine.django.auth.User')

With the second it prints: <class 'mongoengine.django.auth.User'>

However, I added SOCIAL_AUTH_USER_MODEL = 'mongoengine.django.auth.User' and I get:

default.usersocialauth: 'user' has a relation with model mongoengine.django.auth.User, which has either not been installed or is abstract.

which looks like mongo doesn't import the model. I tracked the error on a question on StackOverflow so I created a model in my models.py as in the example. However now I get:

django.core.management.base.CommandError: One or more models did not validate:
apps.user: Accessor for m2m field 'groups' clashes with related m2m field 'Group.user_set'. Add a related_name argument to the definition for 'groups'.
apps.user: Accessor for m2m field 'user_permissions' clashes with related m2m field 'Permission.user_set'. Add a related_name argument to the definition for 'user_permissions'.
auth.user: Accessor for m2m field 'groups' clashes with related m2m field 'Group.user_set'. Add a related_name argument to the definition for 'groups'.
auth.user: Accessor for m2m field 'user_permissions' clashes with related m2m field 'Permission.user_set'. Add a related_name argument to the definition for 'user_permissions'.
default.usersocialauth: 'user' has a relation with model mongoengine.django.auth.User, which has either not been installed or is abstract.

If my class is not User(AbstractBaseUser, PermissionsMixin) it will pop up the same error as above (not been installed or is abstract).

@omab
Copy link
Owner

omab commented Sep 23, 2013

According to your settings on SO you have 'social.apps.django_app.default' in your installed apps, remove that one.

@Diolor
Copy link
Author

Diolor commented Sep 23, 2013

And that solved it. Thanks

@omab
Copy link
Owner

omab commented Sep 23, 2013

No problem.

@omab omab closed this as completed Sep 23, 2013
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

2 participants