|
|
@ -20,13 +20,13 @@ class Command(createsuperuser.Command): |
|
|
|
|
|
|
|
try: |
|
|
|
super().handle(*args, **options) |
|
|
|
self.stderr.write(f'try executed') |
|
|
|
except (IntegrityError, CommandError): |
|
|
|
pass |
|
|
|
self.stderr.write(f'User {username} already exists.') |
|
|
|
|
|
|
|
if password: |
|
|
|
database = options.get('database') |
|
|
|
db = self.UserModel._default_manager.db_manager(database) |
|
|
|
user = db.get(username=username) |
|
|
|
user.set_password(password) |
|
|
|
self.stderr.write(f'Setting password for User {username}.') |
|
|
|
user.save() |