Exemple #1
0
def show_tag(tag_id):
    """
    Show titles associated with given tag tag_id
    """

    try:
        tags = Tag.select().where(Tag.id == tag_id).order_by(Tag.name)
    except Tag.DoesNotExist:
        return render_template("error.html",
                               response='Tag ' + tag_id + ' does not exist')

    # Filter Volume on given Tag ID

    t = Volume.select().join(Tag).where(Tag.id == tag_id).order_by(
        Volume.title)
    return render_template("tag.html", tags=tags, title=t)
Exemple #2
0
def filter_tags(filter_string):
    """
    Display list of titles filtered by tags
    filter_string is dot-separated list of tag IDs

    Check that each tag id exists
    """
    filter_list = []
    filters = filter_string.split = (".")

    for x in filters:
        try:
            tag = Tag.get(id == x)
        except Tag.DoesNotExist:
            continue

        filter_list.append(x)

    # Filter titles on list of tag IDs

    t = Volume.select().join(Tag).where(Tag.id.in_(filter_list))
    return render_template("tags.html", tags=filter_list, title=t)
Exemple #3
0
def thumb_list():

    vols = Volume.select().order_by(Volume.title)

    return render_template("thumbs.html", vols=vols)