Ejemplo n.º 1
0
def display_melons():
    """Display all of the melons."""

    # here, it makes more sense to pass a sorted list of keys, as we will
    # be using all parts of the value dictionaries in the template
    sorted_melon_ids = sorted(melons.keys())

    return render_template("melons.html",
                           sorted_melon_ids=sorted_melon_ids,
                           melons=melons)
Ejemplo n.º 2
0
def display_order_form():
    """Display a form for ordering melons."""

    # a list comprehension to get a sorted list of melon ids and names
    sorted_melons = [(melon_id, melons[melon_id]['name'])
                     for melon_id in sorted(melons.keys())]

    return render_template("order.html",
                           sorted_melons=sorted_melons,
                           states=states)