Esempio n. 1
0
def index():
    data = 0
    sites = Site(current_app)
    site = sites.totalcount()
    seeds = Seed(current_app)
    seed = seeds.totalcount()
    users = User(current_app)
    uid = session['uid']
    user = users.view(uid)
    lastlogin = user[0]["lastlogintime"]
    return render_template("index.html", site=site, seed=seed, data=data, lastlogin=lastlogin)
Esempio n. 2
0
def index(page=1):
    site = Site(current_app)
    filte = None
    if request.method == "POST":
        error = None
        action = request.form.get("do")
        if action == "delete":
            uids = request.form.getlist("id[]")
            if len(uids) > 0:
                for uid in uids:
                    if uid:
                        site.remove(uid)
                return redirect(url_for("sites.index"))
            else:
                error = "请选择要删除的数据"
        return error
    if request.args.get("keywords"):
        filte = "name='" + request.args.get("keywords") + "'"
    sites = site.list(page, PER_PAGE, filte)
    if not sites and page != 1:
        abort(404)
    count = site.totalcount()
    pagination = Pagination(page, PER_PAGE, count)
    return render_template("site/list.html", pagination=pagination, sites=sites)