예제 #1
0
def show_story():
    """Show Madlib result."""

    # arguments received from form
    answers = request.args
    text = story.generate(answers)
    return render_template("story.html", text=text)
예제 #2
0
파일: app.py 프로젝트: mtoprak53/SECT_Study
def tell_story():
    words = story.prompts
    answers = {}
    for word in words:
        answers[word] = request.args[word]
    text = story.generate(answers)
    return render_template('story.html', text=text)
예제 #3
0
def story_route():
    '''render Story page. create a story instance'''
    answers = request.args
    user_story = story.generate(answers)
    return render_template('story.html', user_story=user_story)

    
예제 #4
0
def madlib_story():
    """Show the story generated"""

    answers = request.form

    return render_template("madLibStory.html",
                           your_story=story.generate(answers))
예제 #5
0
def answer(stories):
    """Return Answer to Selected Story """
    print(stories)
    story = STORIES[stories]
    text = story.generate(request.args)

    return render_template("answer.html", text=text)
예제 #6
0
def show_story():
    """Make a dictionary where the keys are the prompts and the 
    values are the answers for the prompts.
    """
    answer = {}
    for key in request.args:
        answer[key] = request.args[key]
    return render_template('story.html', story = story.generate(answer))
예제 #7
0
def get_story():
    """Get the prompts and diplay the story"""
    answers = {}
    for word in story.prompts:
        answers[word] = request.args.get(word)

    story_content = story.generate(answers)

    return render_template("story.html", story=story_content)
예제 #8
0
def story_display():
    prompt_result_dict = {}
    # story_out = request.form
    # print(request.form)
    for prompt in story.prompts:
        prompt_result_dict[prompt] = request.args[prompt]

    story_out = story.generate(prompt_result_dict)
    return render_template('story-display.html', story_out=story_out)
예제 #9
0
def get_story():
    " Takes answers from the madlibs form and generates a madlib, then shows it "

    ans = {}
    for prompt in story.prompts:
        ans[prompt] = request.args.get(prompt)
    s = story.generate(ans)

    return render_template('/story.html', story=s)
예제 #10
0
파일: app.py 프로젝트: herfalerf/madlibs
def get_story_1():
    """Display madlib story"""
    choices = {
        "place": request.args["place"],
        "adjective": request.args["adjective"],
        "noun": request.args["noun"],
        "verb": request.args["verb"],
        "plural_noun": request.args["plural_noun"]
    }
    return render_template("story-1.html", madlib=story.generate(choices))
예제 #11
0
def show_story():
    """Show story result."""

    # in text example: Once upon a time in a long-ago Nigeria, there lived a
    # large Fast Dog. It loved to Fishing Cats.

    # request.args example: ([('place', 'Nigeria'), ('noun', 'Dog'), ('verb', 'Fishing'), ('adjective', 'Fast'), ('plural_noun', 'Cats')])
    print(f'I am {request.args}')
    text = story.generate(request.args)

    return render_template("story.html", text=text)
예제 #12
0
def show_story():
    """Show story result."""

    # in text example: Once upon a time in a long-ago Nigeria, there lived a
    # large Fast Dog. It loved to Fishing Cats.

    # request.args are the key value pairs passed from the form
    # request.args example: ([('place', 'Nigeria'), ('noun', 'Dog'), ('verb', 'Fishing'), ('adjective', 'Fast'), ('plural_noun', 'Cats')])
    print(f'I am {request.args}')
    # generate replaces all of the keys in the text with their values
    text = story.generate(request.args)

    return render_template("story.html", text=text)
예제 #13
0
def get_story():
    place = request.args.get('place')
    noun = request.args.get('noun')
    verb = request.args.get('verb')
    adjective = request.args.get('adjective')
    plural_noun = request.args.get('pluralNoun')
    answers = {
        'place': place,
        'noun': noun,
        'verb': verb,
        'adjective': adjective,
        'plural_noun': plural_noun
    }
    return render_template('displayStory.html', story=story.generate(answers))
예제 #14
0
def madlibs_story():
    """Generate story from inputs"""
    prompts = story.prompts
    args = request.args

    answers = {
        prompts[i]: args.get(str(i) + prompts[i])
        for i in range(len(prompts))
    }
    # for i in range(len(prompts)):
    #     answers[prompts[i]] = args.get(str(i)+prompts[i])

    showing_story = story.generate(answers)

    return render_template("story.html", story_to_show=showing_story)
예제 #15
0
def generate_story():
    """Takes in inputs from form and pulls in text variable
    from story class to generate a story on the page"""

    prompts_from_instance = story.prompts
    user_word_input = [
        request.args.get(prompt) for prompt in prompts_from_instance
    ]

    prompt_and_input = {
        prompts_from_instance[i]: user_word_input[i]
        for i in range(len(prompts_from_instance))
    }

    # simpler way to get prompt_and_input in a dict format is just using request.args() with no arguments

    story_text = story.generate(prompt_and_input)

    return render_template('story.html', story_text=story_text)
예제 #16
0
def show_story():
    place = request.args['place']
    noun = request.args['noun']
    adjective = request.args['adjective']
    verb = request.args['verb']
    plural_noun = request.args['plural_noun']
    new_story_parts = {
        'place': place,
        'adjective': adjective,
        'noun': noun,
        'verb': verb,
        'plural_noun': plural_noun
    }
    text = story.generate(new_story_parts)
    return render_template('story.html',
                           place=place,
                           noun=noun,
                           verb=verb,
                           plural_noun=plural_noun,
                           adjective=adjective,
                           text=text)
예제 #17
0
def story_page():
    first_word = request.args["first_word"]
    second_word = request.args["second_word"]
    third_word = request.args["third_word"]
    fourth_word = request.args["fourth_word"]
    fifth_word = request.args["fifth_word"]
    template = request.args["template"]

    response = {}
    ans = [first_word, second_word, third_word, fourth_word, fifth_word]

    for i in range(0, 5):
        response[story.prompts[i]] = ans[i]

    if template == "1":
        newStory = story.generate(response)
    elif template == "2":
        newStory = story2.generate(response)
    elif template == "3":
        newStory = story3.generate(response)
    elif template == "4":
        newStory = story4.generate(response)

    return render_template("story.html", newStory=newStory, template=template)
예제 #18
0
def story_page():
    """Returns Story Page"""
    text = story.generate(request.args)
    return render_template("story.html", story = text)
예제 #19
0
def show_story():
    title = story.title
    text = story.generate(request.args)
    return render_template('story.html', title=title, text=text)
예제 #20
0
파일: app.py 프로젝트: kwmybh/flask_madlib
def show_story():
    """Show story result."""

    text = story.generate(request.args)

    return render_template('story.html', text=text)
예제 #21
0
def generate_story():

    return render_template("story.html", text=story.generate(request.args))
예제 #22
0
def render_story():
    words_dict = {}
    for word in request.args:
        words_dict[word] = request.args.get(word)
    story_text = story.generate(words_dict)
    return render_template('madlib.html', your_story=story_text)
예제 #23
0
def show_story():
    t = story.generate(request.args)

    return render_template("story.html", text=t)
예제 #24
0
def make_story():
    my_story = default_story.generate(request.args)
    return render_template("story.html", content=my_story)
예제 #25
0
def create_story():
    """Story page that generates the story based on arguments from the form page"""
    text = story.generate(request.args)
    return render_template("story.html", text=text)
예제 #26
0
파일: app.py 프로젝트: fact0/madLibs
def render_story():
    """Renders story with passed in arguments."""
    text = story.generate(request.args)

    return render_template("story.html", text=text)
예제 #27
0
def story_route():
    answers = {}
    for arg in request.args:
        answers[arg] = request.args[arg]
    complete_story = story.generate(answers)
    return render_template('story.html', story=complete_story)
예제 #28
0
def show_story():
    if request.method == 'POST':
        story_text = story.generate(request.form)
        return render_template('story.html', story_text=story_text)
예제 #29
0
def story_time():
    """Tell the story."""

    text = story.generate(request.args)

    return render_template("story.html", text=text)
예제 #30
0
def get_data():
    answers = story.generate(request.args)
    print(answers)
    return render_template("result.html", answers=answers)