-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove User.is_staff and User.is_superuser fields
The User.is_staff and User.is_superuser models fields were not used anywhere so they and related code have been removed. We once used django.contrib.admin but no longer do (instead having a completely custom staff app). The User model has, for some time, sub-classed AbstractBaseUser, not AbstractUser, to be more customizable. The removed User fields are present on AbstractUser but not AbstractBaseUser. They were only present on our User model because django.contrib.admin required them to be present, when we used it. UserManager needed a custom create_user function adding, as django.contrib.auth.models.UserManager.create_user sets a default for is_staff and is_superuser. This may be a hint we should be using BaseUserManager over UserManager. See comments and #4627. The `create_user` management command does not touch these fields explicitly, so no changes there.
- Loading branch information
1 parent
edc734a
commit d15bc66
Showing
6 changed files
with
55 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
jobserver/migrations/0007_remove_user_is_staff_remove_user_is_superuser.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Generated by Django 5.1.1 on 2024-09-30 14:13 | ||
|
||
from django.db import migrations | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
("jobserver", "0006_remove_user_socialauth_token_type"), | ||
] | ||
|
||
operations = [ | ||
migrations.RemoveField( | ||
model_name="user", | ||
name="is_staff", | ||
), | ||
migrations.RemoveField( | ||
model_name="user", | ||
name="is_superuser", | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters