Skip to content

Bugfix change CustomUser's manager to enable migration making#451

Merged
dybi merged 1 commit intomasterfrom
bugfix-cannot-create-new-migrations
Jul 23, 2019
Merged

Bugfix change CustomUser's manager to enable migration making#451
dybi merged 1 commit intomasterfrom
bugfix-cannot-create-new-migrations

Conversation

@maciejSamerdak
Copy link
Collaborator

No issue for this.

Fixes an issue where makemigrations call fails with an error, related to CustomUsers's manager class not being found.

@maciejSamerdak maciejSamerdak added bug Something isn't working priority high Tasks with high priority labels Jul 22, 2019
@maciejSamerdak maciejSamerdak added this to the next_release milestone Jul 22, 2019
@maciejSamerdak maciejSamerdak self-assigned this Jul 22, 2019
operations = [
migrations.AlterModelManagers(
name='customuser',
managers=[
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess it's okay, since the manager is now created dynamically?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like thanks to this CustomUser managers will no longer be tracked in migrations, so it should be ok.



class CustomUserManager(BaseUserManager):
use_in_migrations = True
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The usage of this property is obscure. According to Django documentation it has to do with serialisation. @Szymiks reported seeing this on forums regarding REST framework. This line was created by @MartynaAnnaGottschling back in October 2018. full-check did not raise any errors after it got removed.

Is it therefore safe to assume that this is a leftover from the REST implementation and can be safely deleted?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not related with REST exactly, but with possibility to use custom manager methods in migrations. As we don't use them, lets remove it.

Copy link
Contributor

@dybi dybi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, but please wait till @rwrzesien gives his insights ;)

@dybi dybi merged commit dc0a983 into master Jul 23, 2019
@dybi dybi deleted the bugfix-cannot-create-new-migrations branch July 23, 2019 10:06
@kbeker kbeker changed the title Change CustomUser's manager to enable migration making Bugfix change CustomUser's manager to enable migration making Jul 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working priority high Tasks with high priority

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants