Tag-based Categorization
Content can be labelled in an ad-hoc fashion with tags. Typically tags will be displayed on the frontend using a ‘tag cloud’, rather than listing all tags. This means you can tag all you want!
Tag (keyword) for labelling content
Display name
A unique URL-friendly permalink string for looking up this object.
Convert a comma separated string into a list of tag names.
Return a list of Tag instances that match the given names.
Tag names that don’t yet exist are created automatically and returned alongside the results that did already exist.
If you try to create a new tag that would have the same slug as an already existing tag, the existing tag is used instead.
Parameters: | tag_names (list) – The display Tag.name |
---|---|
Returns: | A list of Tag instances. |
Return type: | TagList instance |
Category Mapped Class
Return a list of ancestors, starting with the root node.
This method is optimized for when all categories have already been fetched in the current DBSession:
>>> Category.query.all() # run one query
>>> row = Category.query.get(50) # doesn't use a query
>>> row.parent # the DBSession recognized the primary key
<Category: parent>
>>> print row.ancestors()
[...,
<Category: great-grand-parent>,
<Category: grand-parent>,
<Category: parent>]
Return this category’s distance from the root of the tree.
Return a list of descendants in depth-first order.
Iterate over all nested categories in depth-first order.