-
Notifications
You must be signed in to change notification settings - Fork 0
Bugfix change CustomUser's manager to enable migration making #451
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| # Generated by Django 2.2.3 on 2019-07-22 11:31 | ||
|
|
||
| from django.db import migrations | ||
|
|
||
|
|
||
| class Migration(migrations.Migration): | ||
|
|
||
| dependencies = [ | ||
| ('users', '0005_auto_20190703_1737'), | ||
| ] | ||
|
|
||
| operations = [ | ||
| migrations.AlterModelManagers( | ||
| name='customuser', | ||
| managers=[ | ||
| ], | ||
| ), | ||
| ] | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -39,8 +39,6 @@ def get_with_prefetched_reports(self, reports: QuerySet) -> QuerySet: | |
|
|
||
|
|
||
| class CustomUserManager(BaseUserManager): | ||
| use_in_migrations = True | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. Is it therefore safe to assume that this is a leftover from the REST implementation and can be safely deleted?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. |
||
|
|
||
| def _create_user( | ||
| self, email: str, password: str, is_staff: bool, is_superuser: bool, user_type: str | ||
| ) -> "CustomUser": | ||
|
|
||
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
CustomUsermanagers will no longer be tracked in migrations, so it should be ok.