Do not require an admin password on upgrade.

This commit makes us only require an admin password if there is a new
admin user.
This commit is contained in:
Luke Sneeringer 2014-12-03 13:11:30 -06:00
parent fcc7d3d7b1
commit 6f09bb16ba

View File

@ -0,0 +1,22 @@
# Copyright (c) 2014 Ansible, Inc.
# All Rights Reserved
import sys
from django.contrib.auth.models import User
from django.core.management.base import BaseCommand, CommandError
class Command(BaseCommand):
"""A command that reports whether a username exists within the
system or not.
"""
def handle(self, *args, **options):
any_not_found = False
for username in args:
if User.objects.filter(username=username).count():
print('User %s exists.' % username)
else:
print('User %s does not exist.' % username)
any_not_found = True