Template tags which can do retrieval of content from any model.
default ordering, and stores it in a context variable. The optional field argument specifies which field to get_latest_by, otherwise the model’s default is used
Syntax:
{% get_latest_object [app_name].[model_name] [field] as [varname] %}
Example:
{% get_latest_object comments.freecomment submitted_date as latest_comment %}
This is a function tag.
model’s default ordering, and stores them in a context variable. The optional field argument specifies which field to get_latest_by, otherwise the model’s default is used
Syntax:
{% get_latest_objects [app_name].[model_name] [num] [field] as [varname] %}
Example:
{% get_latest_objects comments.freecomment 5 submitted_date as latest_comments %}
This is a function tag.
context variable.
Syntax:
{% get_random_object [app_name].[model_name] as [varname] %}
Example:
{% get_random_object comments.freecomment as random_comment %}
This is a function tag.
them in a context variable.
Syntax:
{% get_random_objects [app_name].[model_name] [num] as [varname] %}
Example:
{% get_random_objects comments.freecomment 5 as random_comments %}
This is a function tag.
lookup, and stores it in a context variable.
Syntax:
{% retrieve_object [app_name].[model_name] [lookup kwargs] as [varname] %}
Example:
{% retrieve_object flatpages.flatpage pk=12 as my_flat_page %}
This is a function tag.