Example #1
0
def lesson_plan():
    try:
        if request.method == "POST":
            session = DBSession()
            unit_value = request.form.get("unit", None)
            title_value = request.form.get("title", None)
            purpose_value = request.form.get("purpose")
            grade_value = request.form.get("grade")
            description_value = request.form.get("description", None)
            time_value = request.form.get("time", None)
            user_id_value = current_user.get_id()
            file = request.files["video"]
            if file is not None:
                file.save(
                    os.path.join("./uploads", secure_filename(file.filename)))
            lesson_plan = LessonPlan(unit=unit_value,
                                     title=title_value,
                                     purpose=purpose_value,
                                     class_value=grade_value,
                                     user_id=user_id_value,
                                     description=description_value,
                                     timestamp=time_value)
            session.add(lesson_plan)
            if file is not None:
                added_lesson_plans = session.query(LessonPlan).all()
                pic = Pics(path=application.config["UPLOAD_FOLDER"] +
                           file.filename,
                           lesson_id=added_lesson_plans[-1].id)
                session.add(pic)
            session.commit()
            return redirect(url_for("lesson_detail"))
        else:
            return render_template("create_lesson.html")
    except Exception as e:
        raise e
Example #2
0
def signup():
    try:
        if request.method == "POST":
            session = DBSession()
            email_value = request.form.get("email", None)
            name_value = request.form.get("name", None)
            password_value = (hashlib.md5(
                request.form["password"].encode())).hexdigest()
            location_value = request.form.get("location", None)
            unit_preferred_value = request.form.get("unit", None)
            phone_number_value = request.form.get("phone", None)
            school_value = request.form.get("school", None)
            user = User(email=email_value,
                        name=name_value,
                        password=password_value,
                        location=location_value,
                        unit_preferred=unit_preferred_value,
                        school=school_value,
                        phone_number=phone_number_value)
            session.add(user)
            session.commit()
            return redirect(url_for('dashboard'))
        else:
            return render_template("login.html")
    except Exception as e:
        raise e
Example #3
0
def add_video(videoid):
    try:
        session = DBSession()
        video = Videos(user_id=current_user.get_id(), video_link=videoid)
        session.add(video)
        session.commit()
        return redirect(url_for("lesson_detail"))
    except Exception as e:
        raise e
Example #4
0
def newstory():
	if request.method == 'GET':
		return render_template('test.html')
	else:
		new_name = request.form['username']
		new_writer = request.form['email']
		new_content = request.form['password']
		new_pic = request.form['age']
		new_story=Story(name= new_name,writer=new_writer, story= new_content , pic= new_pic)
		DBSession.add(new_story)
		DBSession.commit()
		return redirect(url_for('signin'))
Example #5
0
def signup():
	if request.method == 'GET':
		return render_template('signup2.html')
	else:
		new_name = request.form['username']
		new_email = request.form['email']
		new_password = hash_password(request.form['password'])
		new_age = request.form['age']
		new_user= User(name=new_name,email=new_email,password=new_password,age = new_age)
		DBSession.add(new_user)
		DBSession.commit()
		session['name'] = new_name
		return redirect(url_for('home'))
Example #6
0
def comments():
    try:
        if request.method == "POST":
            session = DBSession()
            comment = request.form.get("comment", None)
            time = request.form.get("time", None)
            video = request.form.get("video_link", None)
            comment_value = Comment(data=comment,
                                    timestamp=time,
                                    video_id=video,
                                    user_id=current_user.get_id(),
                                    parent_id=1)
            session.add(comment_value)
            session.commit()
            data = ["video_detail", video]
            if (current_user.email == "*****@*****.**"):
                session = DBSession()
                video = session.query(Videos).all()
                login_user(user)
                return render_template("admin_dashboard.html", videos=video)
            return redirect(url_for('lesson_detail'))
    except Exception as e:
        print e
items = [
    'Burger',
    'Fries',
    'Ice Cream Cone',
    'Chicken Sandwich',
    'Salad',
    'Onion Rings',
    'Soft Drink'
]

description_list = """Bacon ipsum dolor amet tri-tip spare ribs kevin strip steak, andouille beef ribs corned beef pastrami shank pork porchetta tail turducken sirloin. Kielbasa meatball short ribs hamburger jerky flank, shoulder chuck. Ground round venison boudin pork belly brisket. Drumstick ball tip ground round doner, landjaeger sausage pork chop venison chicken jowl hamburger. Sausage brisket pork, ham jowl ribeye alcatra. Ribeye jowl flank, ham hock tail fatback boudin ball tip shoulder drumstick shankle andouille. Swine shoulder leberkas, brisket ribeye tail pork chop tongue fatback cupim.
Ground round pork belly shankle frankfurter, ball tip meatball cow. Brisket salami porchetta ground round pig hamburger short ribs ball tip shank. Shankle venison pork belly shank. Beef rump kevin biltong meatloaf andouille capicola bacon. Shankle rump kevin drumstick cow.
Shankle drumstick landjaeger pork loin shoulder ribeye swine. Swine boudin jowl ball tip prosciutto bresaola flank bacon. Rump flank ground round swine cupim. Chuck drumstick frankfurter pork chop, hamburger meatloaf meatball cupim pastrami salami turkey bresaola tri-tip. Tri-tip turkey bresaola brisket strip steak sausage short ribs pastrami beef venison. Pancetta frankfurter pork loin, shank short ribs short loin brisket sirloin meatball tail shankle pastrami. Rump capicola meatball ham hock beef ham t-bone tongue turducken bresaola doner andouille.
Sausage jerky ground round short loin. Brisket kevin strip steak hamburger. Turducken jerky pastrami, leberkas bresaola picanha drumstick porchetta ground round beef. Rump alcatra meatball fatback strip steak ribeye. Cow tongue biltong brisket, alcatra andouille frankfurter shankle bresaola bacon sausage corned beef pork venison.
Filet mignon tongue ham, landjaeger pastrami jowl meatloaf pork belly. Short loin chuck swine pork chop. Cupim andouille spare ribs doner shank pork meatball, pancetta ribeye short loin pork loin turducken tri-tip tongue. Ham hock meatloaf short loin prosciutto, ham turducken short ribs beef pork chop jowl cow pancetta bresaola venison turkey. Tri-tip landjaeger alcatra chicken cupim. Boudin jowl doner, pastrami porchetta turkey ham hock. Beef ribs leberkas ham hock pork chop, spare ribs meatball boudin.""".split(
    '\n')

restaurants = list(session.query(Restaurant).all())

for item in items:
    m = MenuItem(
        name=item,
        description=random.choice(description_list),
        price=round(random.uniform(1.0, 5.0), 2),
        restaurant=random.choice(restaurants)
    )
    session.add(m)

session.commit()