Django-inline-media comes with two filters and one tag:
- filter render_inlines
- filter extract_inlines
- tag get_inline_types
To use any of them in your templates you first need to load them:
{% load inlines %}
Renders inlines in a text by passing them through inline templates.
Syntax:
{{ <field>|render_inlines }}
Inline Syntax (singular):
<inline type="<app_name>.<model_name>" id="<id>" class="<cssclass>" />
Inline Syntax (plural):
<inline type="<app_name>.<model_name>" ids="<id>, <id>, <id>" />
It would be wise to anticipate both object_list and object unless you know for sure one or the other will only be present.
Example usage:
{{ object.body|render_inlines }}
Extract inlines from a text.
Syntax:
{{ <field>|extract_inlines }}
Example usage:
{% for inline in object.body|extract_inlines %}
{% ifequal inline.content_type "inline_media.picture" %}
{% include "inline_media/inline_media_picture.html" with object=inline.object class=inline.class %}
{% endifequal %}
{% endfor %}
Gets all inline types.
Syntax:
{% get_inline_types as [var_name] %}
Example usage:
{% get_inline_types as inline_list %}