update erd db and add display name to user access table
This commit is contained in:
1 parent
ed84d989b7
commit
ae2ea27ae2
13 files changed
+91
-10
No files matched your search
@@ -16,13 +16,23 @@ class Command(BaseCommand):
|
||||
def handle(self, *args, **options):
|
||||
user, created = User.objects.get_or_create(
|
||||
user_name="admin",
|
||||
defaults={"status": User.STATUS_SUPERADMIN, "is_staff": True, "is_superuser": True},
|
||||
defaults={
|
||||
"display_name": "Admin",
|
||||
"status": User.STATUS_SUPERADMIN,
|
||||
"is_staff": True,
|
||||
"is_superuser": True,
|
||||
},
|
||||
)
|
||||
if created or not user.has_usable_password():
|
||||
user.set_password("admin123")
|
||||
user.status = User.STATUS_SUPERADMIN
|
||||
if not (user.display_name or "").strip():
|
||||
user.display_name = "Admin"
|
||||
user.save()
|
||||
self.stdout.write("Created/updated user admin / admin123")
|
||||
elif not (user.display_name or "").strip():
|
||||
user.display_name = "Admin"
|
||||
user.save(update_fields=["display_name", "updated_at"])
|
||||
|
||||
raw_key = None
|
||||
bootstrap = settings.BOOTSTRAP_API_KEY
|
||||
|
||||
Reference in new issue
Block a user