def tagBlock(tag, **kwargs): """ Displays a tag block, for the tag list page Takes a tag, AddTagForm and RemoveTagForm. """ kwargs["tag"] = tag kwargs["implies"] = Tag.expand_implies_check(tag.tags.all()) kwargs["renametf"] = RenameTagForm(instance=tag) return kwargs
def bookmark(bookmark, untag=None, **kwargs): """ Displays a bookmark as a block A bookmark block is a HTML element with the class "block", surprisingly enough, and consist of a head and a body. The head is always visible, but the body is only visible when you click the button, and contains buttons to edit the bookmark. """ kwargs["bm"] = bookmark kwargs["tags"] = Tag.expand_implies_check(bookmark.tags.all()) return kwargs
def autotag(autotag, untag=None, **kwargs): """ Displays an autotag as a block An autotag block is a HTML element with the class "block", surprisingly enough, and consists of a head and a body. The head is always visible, but the body is only visible when you click the button, and contains buttons to edit the autotag. """ kwargs["at"] = autotag kwargs["tags"] = Tag.expand_implies_check(autotag.tags.all()) kwargs["colour"] = "white" for (t, _) in kwargs["tags"]: if t.colour != "white": kwargs["colour"] = t.colour break return kwargs