def init(username, password): click.echo('initilize the database') db.create_all() admin = Admin.query.first() if admin is not None: click.echo("the administrator already exists, updating...") admin.username = username admin.set_password(password) else: click.echo("Creating the temporary adminstrator account") admin = Admin(username=username, blog_title='Bluelog', blog_sub_title="No, I'm the real thing.", name='Admin', about='Anything about you.') admin.set_password(password) db.session.add(admin) category = Category.query.first() if category is None: click.echo("Creating the default category...") category = Category(name='Default') db.session.add(category) db.session.commit() click.echo('None')
def init(username, password): """Building Blog, just for you.""" click.echo("Initializing the database...") db.create_all() admin = Admin.query.first() if admin: click.echo("The administrator already exists, updating... ") admin.username = username admin.set_password(password) else: click.echo("Creating the temporary administrator account...") admin = Admin( username=username, blog_title="Blog", blog_sub_title="No, I'm the real thing.", name="Admin", about="Anything about you.", ) admin.set_password(password) db.session.add(admin) category = Category.query.first() if not category: click.echo("Creating the default category... ") category = Category(name="Default") db.session.add(category) db.session.commit() click.echo("Done.")
def init(username, password): """Building myblog, just for you.""" click.echo('初始化数据库中...') db.create_all() admin = Admin.query.first() if admin is not None: click.echo('管理员已存在,更新管理员中...') admin.username = username admin.set_password(password) else: click.echo('新建一个管理员账号...') admin = Admin( username=username, blog_title='myblog', ) admin.set_password(password) db.session.add(admin) category = Category.query.first() if category is None: click.echo('正在新建一个默认分类...') category = Category(name='默认') db.session.add(category) db.session.commit() click.echo('已完成')
def init(username, password): """Building Bluelog, just for you.""" click.echo('Initializing the database...') db.create_all() admin = Admin.query.first() if admin is not None: click.echo('The administrator already exists, updating...') admin.username = username admin.set_password(password) else: click.echo('Creating the temporary administrator account...') admin = Admin( username="******", blog_title='ligewudi', blog_sub_title="cookie!", name='lyh', about="a little bit of niubi", ) admin.set_password(password) db.session.add(admin) category = Category.query.first() if category is None: click.echo('Creating the default category...') category = Category(name='Default') db.session.add(category) db.session.commit() click.echo('Done.')
def init(username, password): """Building MyBlog, just for you.""" click.echo('Initializing the database...') db.create_all() admin = Admin.query.first() if admin: # 如果数据库中已经有管理员记录就更新用户和密码 click.echo('The administrator already exsists, updating...') admin.username = username admin.set_password(password) else: click.echo('Creating the temporary administrator account...') admin = Admin(username=username, blog_title='MyBlog', blog_sub_title="Discover the beauty everywhere.", name='Admin', about='Some things about you') admin.set_password(password) db.session.add(admin) category = Category.query.first() if category is None: click.echo('Creating the default category...') category = Category(name='default') db.session.add(category) db.session.commit() click.echo('Done.')
def init(username, password): """Building myblog, just for you.""" click.echo('Initializing the database...') db.create_all() admin = Admin.query.first() if admin is not None: click.echo('The administrator already exists, updating...') admin.username = username admin.set_password(password) else: click.echo('Creating the temporary administrator account...') admin = Admin( username=username, blog_title='myblog', name='Admin', ) admin.set_password(password) db.session.add(admin) category = Category.query.first() if category is None: click.echo('Creating the default category...') category = Category(name='Default') db.session.add(category) db.session.commit() click.echo('Done.')
def init(username, password): click.echo('初始化数据库...') db.create_all() admin = Admin.query.first() if admin is not None: # 如果管理员已经存在就更新用户名和密码 click.echo('管理员已经存在,正在更新...') admin.username = username admin.set_password(password) else: # 否则,创建新管理员 click.echo('创建临时管理员帐户...') admin = Admin(username="******", blog_title="维度's Blog", blog_sub_title="快乐生活,快乐编程!", name="Gweid", about="我,Gweid,一个小小的程序员...") admin.set_password(password) db.session.add(admin) category = Category.query.first() if category is None: click.echo('创建默认分类...') category = Category(name='默认') db.session.add(category) db.session.commit() click.echo('完成')
def fake_admin(): # 生成虚拟管理员 admin=Admin(username='******', blog_title='Myblog', blog_sub_title="No.I'm the real thing.", name='Mima Kirigoe', about='Um,I,Mima Kirigoe,had a fun times as a member of CHAM...') admin.set_password('helloflask') db.session.add(admin) db.session.commit()
def fake_admin(): admin = Admin(username='******', blog_title='MyBlog', blog_sub_title='test', name='Taoist', about='Hi...') admin.set_password('admin123') db.session.add(admin) db.session.commit()
def fake_admin(): admin = Admin(username='******', blog_title="YF'sBlog", blog_sub_title="I'm the real thing.", name='Mima Kirigoe', about="Welcome to YF's Blog!") admin.set_password('helloflask') db.session.add(admin) db.session.commit()
def fake_admin(): admin = Admin( username='******', blog_title='myblog', name='Mima Kirigoe', ) admin.set_password('helloflask') db.session.add(admin) db.session.commit()
def fake_admin(): """虚拟管理员信息""" admin = Admin(username="******", blog_title="维度's Blog", blog_sub_title="快乐生活,快乐编程!", name="Gweid", about="我,Gweid,一个小小的程序员...") admin.set_password('123456') db.session.add(admin) db.session.commit()
def fake_admin(): admin = Admin(username='******', blog_title='myblog', blog_sub_title='No, I\'m the real thing.', name='Alan Wang', about='lazy to leave anythings~' ) admin.set_password('@123456') db.session.add(admin) db.session.commit()
def fake_admin(): admin = Admin( username="******", blog_title='ligewudi', blog_sub_title="cookie!", name='lyh', about="a little bit of niubi", ) admin.set_password("123321123") db.session.add(admin) db.session.commit()
def fake_admin(): admin = Admin( username='******', blog_title='Cleanlog', name='Syntomic', about='# just for share my knowledge..,' ) admin.set_password('helloflask') db.session.add(admin) db.session.commit()
def fake_admin(): admin = Admin( username="******", blog_title="Blog", blog_sub_title="No,I'm the real thing.", name="Mima kirigoe", about="Hi,I am Mima", ) admin.set_password("helloflask") db.session.add(admin) db.session.commit()
def fake_admin(): admin=Admin( username='******', blog_title='Bluelog', blog_sub_title="No, i am the real thing", name='Mima kirigoe', about='u, i...' ) admin.set_password('helloflask') db.session.add(admin) db.session.commit()
def setUp(self): app = create_app('testing') self.context = app.test_request_context() self.context.push() self.client = app.test_client() self.runner = app.test_cli_runner() db.create_all() user = Admin(name='Grey Li', username='******', about='I am test', blog_title='Testlog', blog_sub_title='a test') user.set_password('123') db.session.add(user) db.session.commit()
def setadmin(username,password): from sqlalchemy.exc import IntegrityError from myblog.models import Admin account = Admin(username=username, password=password) db.session.add(account) db.session.commit()
def setUp(self) -> None: app = create_app("testing") self.context = app.test_request_context() self.context.push() self.client = app.test_client() self.runner = app.test_cli_runner() db.create_all() user = Admin( name="Grey Li", username="******", about="I am test", blog_title="Testlog", blog_sub_title="a test", ) user.set_password("123") db.session.add(user) db.session.commit()
def fake_admin(): admin = Admin( username='******', blog_title='FakeBlog', blog_sub_title="I'm a fake blog", name='Whale Liu', about='um....I actually a fake blog.', ) db.session.add(admin) db.session.commit()
def init(username, password): """Initialize the admin""" click.echo('Initializing the database...') admin = Admin.query.first() if admin is not None: click.echo('The administrator already exists, updating...') admin.username = username admin.set_password(password) else: click.echo('Creating the adminstrator account...') admin = Admin(username=username, blog_title='Cleanlog', name='Syntomic', about='# Anything about you.') admin.set_password(password) db.session.add(admin) db.session.commit() click.echo('Done.')
def init(username, password): """ 注册管理员 :param username: :param password: :return: """ click.echo('Initializing the database...') db.create_all() admin = Admin.query.first() if admin is not None: click.echo('The administrator already exists, updating...') admin.username = username admin.set_password(password) else: click.echo('Creating the temporary administrator account...') admin = Admin( username=username, blog_title='Bluelog', blog_sub_title="No, I'm the real thing.", name='Admin', about='Anything about you.' ) admin.set_password(password) db.session.add(admin) category = Category.query.first() if category is None: click.echo('Creating the default category...') category = Category(name='Default') db.session.add(category) db.session.commit() click.echo('Done.')
def register(): form = RegisterForm() if form.validate_on_submit(): username = form.username.data password = form.password.data error = None if Admin.query.filter(Admin.username == username).first(): error = 'User {} is already exists.'.format(username) if error is None: user = Admin(username=username, password=password) db.session.add(user) db.session.commit() return redirect(url_for('auth.login')) flash(error) return render_template('register.html', form=form)
def fake_admin(): admin = Admin(username="******", blog_title="myblog") admin.set_password('helloflask') db.session.add(admin) db.session.commit()