コード例 #1
0
def render_hub(uri=None):
    if session['email'] is None:
        return redirect("https://kcbootcampers-api-heroku.herokuapp.com/login")
    posts = Post.get_all()
    posts.reverse()
    others = Other.get_all()
    others.reverse()
    books = Book.get_all()
    books.reverse()
    videos = Video.get_all()
    videos.reverse()
    assignments = Assignment.get_all()
    assignments.reverse()
    user = User.get_by_email(session['email'])
    password = "******" * randint(5, 12)
    cellphone = user.cellphone
    fname = user.fname
    lname = user.lname
    if user.status == "*":
        display = "all"
    else:
        display = "none"
    return render_template("hub.html",
                           acc=session['email'],
                           posts=posts,
                           others=others,
                           videos=videos,
                           books=books,
                           assignments=assignments,
                           fname=fname,
                           lname=lname,
                           password=password,
                           cellphone=cellphone,
                           display=display)
コード例 #2
0
def render_admin_hub(uri):
    if session['email'] is None:
        return redirect("https://kcbootcampers-api-heroku.herokuapp.com/login")
    cookie_uri = request.cookies.get('login_id')
    if cookie_uri == uri:
        users = Admin.get_all()
        posts = Post.get_all()
        posts.reverse()
        assignments = Assignment.get_all()
        assignments.reverse()
        others = Other.get_all()
        others.reverse()
        videos = Video.get_all()
        videos.reverse()
        books = Book.get_all()
        books.reverse()
        return render_template(
            "admin_hub.html",
            href="https://kcbootcampers-api-heroku.herokuapp.com/admin/hub/" +
            cookie_uri,
            acc=session['email'],
            posts=posts,
            users=users,
            assignments=assignments,
            others=others,
            videos=videos,
            books=books,
            uri=uri,
            display='all')
    else:
        return render_template(
            "expired.html",
            acc="Account" if session['email'] is None else session['email'])