We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
post_migrate handler create_anonymous_user() breaks when a migration that adds a field to the User model is rolled back.
post_migrate
create_anonymous_user()
Bug is in this line:
User.objects.using(kwargs['using']).get(**lookup)
The problem is that get() tries to fetch all fields, but some of the fields no longer exist (as they were removed in a rollback).
get()
A fix is to fetch the only field we know exists:
User.objects.using(kwargs['using']).filter(**lookup).only(User.USERNAME_FIELD).get()
The text was updated successfully, but these errors were encountered:
HP-1429 Disable django-guardian's anonymous user support
35de6f6
Django-guardian supports giving Django's permissions to anonymous users. This feature has an issue when a field is added or removed in the User model: an exception gets thrown after the migration is run [1]. Open-city-profile doesn't currently use this feature. It can be disabled by setting the `ANONYMOUS_USER_NAME` setting to `None` [2]. [1] django-guardian/django-guardian#770 [2] https://django-guardian.readthedocs.io/en/stable/configuration.html#anonymous-user-name
No branches or pull requests
post_migrate
handlercreate_anonymous_user()
breaks when a migration that adds a field to the User model is rolled back.Bug is in this line:
The problem is that
get()
tries to fetch all fields, but some of the fields no longer exist (as they were removed in a rollback).A fix is to fetch the only field we know exists:
The text was updated successfully, but these errors were encountered: