Beispiel #1
0
def admin(username, password):
    db.create_all()
    user = User.query.first()
    if user is not None:
        click.echo('更新用户信息')
        user.username = username
        user.set_password(password)
    else:
        click.echo('创建用户信息')
        user = User(username=username, name='admin')
        user.set_password(password)
        db.session.add(user)
    db.session.commit()
    click.echo('管理员创建完成')
Beispiel #2
0
def forge():
    name = "Bruce"
    movies = [
        {
            "title": "大赢家",
            "year": "2020"
        },
        {
            "title": "囧妈",
            "year": "2020"
        },
        {
            "title": "战狼 ",
            "year": "2020"
        },
        {
            "title": "心华路放",
            "year": "2020"
        },
        {
            "title": "速度与激情8",
            "year": "2020"
        },
        {
            "title": "我和我的祖国",
            "year": "2020"
        },
        {
            "title": "战狼2",
            "year": "2020"
        },
        {
            "title": "泰囧",
            "year": "2020"
        },
        {
            "title": "港囧",
            "year": "2020"
        },
        {
            "title": "唐人街探案",
            "year": "2020"
        },
        {
            "title": "功夫",
            "year": "2020"
        },
        {
            "title": "喜剧之王",
            "year": "2020"
        },
    ]

    user = User(name=name)
    db.session.add(user)
    for m in movies:
        movie = Movie(title=m['title'], year=m['year'])
        db.session.add(movie)
    db.session.commit()
    click.echo("插入数据完成")
Beispiel #3
0
def forge():
    name = "中国"
    movies = [
        {
            "title": "大赢家",
            "year": "2020"
        },
        {
            "title": "叶问四",
            "year": "2020"
        },
        {
            "title": "唐人街探案",
            "year": "2020"
        },
        {
            "title": "囧妈",
            "year": "2020"
        },
    ]

    user = User(name=name)
    db.session.add(user)
    for m in movies:
        movie = Movies(title=m['title'], year=m['year'])
        db.session.add(movie)
    db.session.commit()
    flash('导入数据完成')
Beispiel #4
0
def forge():
    name = "中国"
    movies = [
        { "title" : "大赢家" , "year" : "2020" },
        { "title" : "叶问4" , "year" : "2020" },
        { "title" : "唐人街探案" , "year" : "2020" },
        { "title" : "囧妈" , "year" : "2020" },
        { "title" : "你麻痹" , "year" : "2020" },
    ]
    
    user = User(name=name)
    db.session.add(user)
    for m in movies:
        movie = Movie(title=m['title'],year=m['year'])
        db.session.add(movie)
    db.session.commit()
    click.echo("插入数据完成")
Beispiel #5
0
def forge():

    name = "Bruce"
    movies = [
        {'title': "大赢家", "year":"2020"},
        {'title': "囧妈", "year":"2020"},
        {'title': "战狼", "year":"2020"},
        {'title': "心花路放", "year":"2020"},
        {'title': "大赢家", "year":"1999"},
    ]

    user = User(name=name)
    db.session.add(user)
    for m in movies:
        movie = Movie(title=m['title'], year=m['year'])
        db.session.add(movie)
    db.session.commit()
    click.echo("插入数据完成")
Beispiel #6
0
def forge():
    name = 'L'
    moviews = [
        {
            "title": "大赢家",
            "year": "2020"
        },
        {
            "title": "速度与激情",
            "year": "2020"
        },
    ]
    user = User(name=name)
    db.session.add(user)
    for m in moviews:
        movie = Movie(title=m['title'], year=m['year'])
        db.session.add(movie)
    db.session.commit()
    click.echo('插入数据完成')