Seed and bootstrap users via user_login.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
4f0abceb20
commit
4eed6b2e87
9 files changed
+65
-43
No files matched your search
@@ -75,8 +75,11 @@ class Command(BaseCommand):
|
||||
defaults["managed_by"] = managed_by
|
||||
|
||||
user, created = User.objects.get_or_create(
|
||||
user_name=spec["user_name"],
|
||||
defaults=defaults,
|
||||
user_login=spec["user_name"],
|
||||
defaults={
|
||||
**defaults,
|
||||
"user_name": spec["user_name"],
|
||||
},
|
||||
)
|
||||
user.status = spec["status"]
|
||||
user.is_superuser = spec.get("is_superuser", False)
|
||||
@@ -98,7 +101,10 @@ class Command(BaseCommand):
|
||||
return user
|
||||
|
||||
def _remove_legacy_staff(self, gm: User) -> None:
|
||||
staff = User.objects.filter(user_name="staff").first()
|
||||
staff = (
|
||||
User.objects.filter(user_login="staff").first()
|
||||
or User.objects.filter(user_name="staff").first()
|
||||
)
|
||||
if not staff:
|
||||
return
|
||||
moved_sites = Site.objects.filter(user=staff).update(user=gm)
|
||||
|
||||
Reference in new issue
Block a user