Example #1
0
def signup():
    form = SignupForm(next=request.args.get('next',None))
    if form.validate_on_submit():
        _username = form.username.data
        _password = form.password.data
        _nickname = form.nickname.data
        user = User(username=_username,password=_password,nickname = _nickname,level = 1)
        user.store()
        return redirect('/admin/users1')
    else:
    #flash("back,errors")
        return render_template('admin/signup.html',form = form)
Example #2
0
def users():
    try:
        _user_results = User.all()
    except Exception,e:
        current_app.logger.error(e)
Example #3
0
def initdata():
    cate1 = Category(name='category1')
    cate1.store()
    cate2 = Category(name='category2')
    cate2.store()
    shop1 = Shop(title="shop1",addr="shop1 addr",star=1)
    shop1.store()
    shop2 = Shop(title="shop2",addr="shop2 addr",star=2)
    shop2.store()
    shop3 = Shop(title="shop3",addr="shop3 addr",star=3)
    shop3.store()

    user1 = User(username="******",password="******",nickname="Test1",level=0)
    user1.store()
    user2 = User(username="******",password="******",nickname="Test2",level=0)
    user2.store()
    user3 = User(username="******",password="******",nickname="Test3",level=0)
    user3.store()
    user4 = User(username="******",password="******",nickname="Test4",level=0)
    user4.store()


#    ls = Category.all()
#    for l in ls:
#        print l.name
#    page = paginate(Signature.all(), 5, request.args.get('start'))
#    print page
    return render_template('admin/shops.html')