def show_story():
    """Show Madlib result."""

    # arguments received from form
    answers = request.args
    text = story.generate(answers)
    return render_template("story.html", text=text)
Exemple #2
0
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)
Exemple #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)

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

    answers = request.form

    return render_template("madLibStory.html",
                           your_story=story.generate(answers))
Exemple #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)
Exemple #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))
Exemple #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)
Exemple #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)
Exemple #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)
Exemple #10
0
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))
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)
Exemple #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)
Exemple #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))
Exemple #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)
Exemple #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)
Exemple #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)
Exemple #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)
Exemple #18
0
def story_page():
    """Returns Story Page"""
    text = story.generate(request.args)
    return render_template("story.html", story = text)
Exemple #19
0
def show_story():
    title = story.title
    text = story.generate(request.args)
    return render_template('story.html', title=title, text=text)
Exemple #20
0
def show_story():
    """Show story result."""

    text = story.generate(request.args)

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

    return render_template("story.html", text=story.generate(request.args))
Exemple #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)
Exemple #23
0
def show_story():
    t = story.generate(request.args)

    return render_template("story.html", text=t)
Exemple #24
0
def make_story():
    my_story = default_story.generate(request.args)
    return render_template("story.html", content=my_story)
Exemple #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)
Exemple #26
0
def render_story():
    """Renders story with passed in arguments."""
    text = story.generate(request.args)

    return render_template("story.html", text=text)
Exemple #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)
def show_story():
    if request.method == 'POST':
        story_text = story.generate(request.form)
        return render_template('story.html', story_text=story_text)
Exemple #29
0
def story_time():
    """Tell the story."""

    text = story.generate(request.args)

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