Open yurkobb opened 4 years ago
Okay, this seems to be an issue with social-core; specifically the MediaWiki backend trying to set a many-to-many attribute (groups
) on the User model.
That seems dangerous, shouldn't groups
be protected anyway?
Adding groups
to SOCIAL_AUTH_PROTECTED_USER_FIELDS
fixes the crash.
Can this issue be moved to social-core
?
Was there ever a resolution to this? I'm seeing the same issue
OK, I finally got my head around this. The SOCIAL_AUTH_PROTECTED_USER_FIELDS setting mentioned above is described here in the docs. Adding:
SOCIAL_AUTH_PROTECTED_USER_FIELDS = ['groups']
to my django settings.py fixed the problem.
I disagree that this is something that should be fixed in social-core. It seems to me that the issue is specific to the django ORM and/or User model, even though the exception is ultimately raised in social-core code. Maybe the right thing to do would be to have something in the social-app-django startup code verify that SOCIAL_AUTH_PROTECTED_USER_FIELDS is set properly and refuse to run (with an explanatory message) if it's not. A hard fail at startup is better than a mysterious failure at runtime.
Getting a
TypeError: Direct assignment to the forward side of a many-to-many set is prohibited. Use groups.set() instead.
after an upgrade from 3.1 to 3.4.It seems the new version is relying on functionality that was removed in Django 2.0? Full traceback: