(self, username, remove)
Adds the admin bit to a user.
Adds the admin bit to a user.
Adds the admin bit to a user .
def run(self, username, remove):
        """Adds the admin bit to a user."""
        user = User.query.filter_by(username=username).first()

        if not user:
            sys.stdout.write('User [{0:s}] does not exist.\n'.format(
                username))
            return
        user.admin = not remove
        db_session.add(user)
        db_session.commit()

        if remove:
            sys.stdout.write('User {0:s} is no longer an admin.\n'.format(
                username))
        else:
            sys.stdout.write('User {0:s} is now an admin.\n'.format(username))
def run ( self , username , remove ) : user = User . query . filter_by ( username = username ) . first ( ) if not user : sys . stdout . write ( 'User [{0:s}] does not exist.\n' . format ( username ) ) return user . admin = not remove db_session . add ( user ) db_session . commit ( ) if remove : sys . stdout . write ( 'User {0:s} is no longer an admin.\n' . format ( username ) ) else : sys . stdout . write ( 'User {0:s} is now an admin.\n' . format ( username ) )