The DjangoCMS render_model_block

In short: We have the situation where we need to load rows of data from a django app model into a Django plugin template.

Example: We enter job openings in Django admin in an app such as aldryn-jobs. Then we want to display these job openings in a DjangoCMS plugin, such as latest job openings. Now, we would like to have Frontend Editing not only on the latest job openings plugin where we can configure stuff like the number of job openings to show but we would also like to have Frontend Editing for each of the job openings which are listed by the plugin.

Enters render_model_block:

<div class="job-box row">
    {% if jobs %}
        {% for job in jobs %}
          {% render_model_block job %}
              {% include 'job_plugin/plugins/include/job.html' %}
          {% endrender_model_block %}
        {% endfor %}
    {% else %}
        <!-- No jobs found -->
    {% endif %}
</div>

and the job.html:

<div class="job-wrapper">
    <a href="{{ instance.link }}">
        <div class="job">
            <h1 class="title">{{ instance.title }}</h1>
            <h2 class="subtitle">{{ instance.subtitle }}</h2>
            <p class="text">{{ instance.job_text }}</p>
        </div>
    </a>
</div>

Inside the render_model_block job is now instance.