Ejemplo n.º 1
0
def validate_user(username, password):
    """
    :param username:
    :param password:
    :return:
    """
    try:
        user = AdminUserModel.get(AdminUserModel.username == username)

    except AdminUserModel.DoesNotExist:
        return None

    if user.password == password:
        return user

    return None
Ejemplo n.º 2
0
def display_users():
    for user in AdminUserModel.select():
        print user.username, user.password
Ejemplo n.º 3
0
            'password': '******',
            'database_name': 'becky db',
            'tables': [

            ]
        },
        {
            'username': '******',
            'password': '******',
            'database_name': 'lynda db',
            'tables': [

            ]
        },
        {
            'username': '******',
            'password': '******',
            'database_name': 'test db',
            'tables': [

            ]
        },
    ]

    for user in users:
        try:
            user_created = AdminUserModel.create(username=user['username'], password=user['password'])
            database = AdminDatabaseModel.create(user=user_created, name=user['database_name'])
        except IntegrityError:
            print "User already exists!"