Tag that will obtain listing of top (priority-wise) objects for a given category and store them in context under given name.
Usage:
{% listing <limit>[ from <offset>][of <app.model>[, <app.model>[, ...]]][ for <category> ] [with children|descendents] as <result> [unique [unique_set_name]] %}
Parameters:
Option Description limit Number of objects to retrieve. offset Starting with number (1-based), starts from first if no offset specified. app.model, ... List of allowed models, all if omitted. category Category of the listing, all categories if not specified. Can be either string (tree path), or variable containing a Category object. children Include items from direct subcategories. descendents Include items from all descend subcategories. result Store the resulting list in context under given name. unique Unique items across multiple listings. unique_set_name Name of context variable used to hold the data is optional.
Examples:
{% listing 10 of articles.article for "home_page" as obj_list %}
{% listing 10 of articles.article for category as obj_list %}
{% listing 10 of articles.article for category with children as obj_list %}
{% listing 10 of articles.article for category with descendents as obj_list %}
{% listing 10 from 10 of articles.article as obj_list %}
{% listing 10 of articles.article, photos.photo as obj_list %}
Unique items across multiple listnings::
{% listing 10 for category_uno as obj_list unique %}
{% listing 4 for category_duo as obj_list unique %}
{% listing 10 for category_uno as obj_list unique unique_set_name %}
{% listing 4 for category_duo as obj_list unique unique_set_name %}
Tag Node representing our idea of a reusable box. It can handle multiple paramters in its body, that can contain other django template. The boxing facility keeps track of box dependencies which allows it to invalidate the cache of a parent box when the box itself is being invalidated.
The object is passed in context as object when rendering the box parameters.
Usage:
{% box <boxtype> for <app.model> with <field> <value> %}
{% box <boxtype> for <var_name> %}
Parameters:
Option Description boxtype Name of the box to use app.model Model class to use field Field on which to do DB lookup value Value for DB lookup var_name Template variable to get the instance from
Examples:
{% box home_listing for articles.article with slug "some-slug" %}{% endbox %}
{% box home_listing for articles.article with pk object_id %}
template_name : {{object.get_box_template}}
{% endbox %}
{% box home_listing for article %}{% endbox %}