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 %}

and the job.html:

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

Inside the render_model_block job is now instance.

Bash Shell Snippets

file extension

find files for a do loop

parameter substitution – undefinded parameters


Bild extrahieren:
ffmpeg -itsoffset -4 -i MOV03788.MPG -vcodec mjpeg -vframes 1 -an -f rawvideo -s 640×480 MOV03788.jpg

Movie umwandeln:
ffmpeg -i MOV03788.MPG -s 480×360 -ar 44100 -r 25 -b 1000k MOV03788.flv

Bash Script:
for f in *.mpg;
echo “Processing $f”
ffmpeg -i “$f” -s 480×360 -ar 44100 -r 25 -b 1000k “${f%.mpg}.flv”

Voraussetzung ist das Paket ffmpeg. Welches sich mit “sudo apt-get install ffmpeg” einfach installieren läßt.
ffmpeg -i beispiel.mpg -s 290×210 -ar 44100 -r 25 -b 1000k beispiel.flv

  • “-i beispiel.mpg” = Die Eingabedatei
  • “-s 290×210” = Die Ausgabegröße; im Beispiel 290px Breite und 210px Höhe
  • “-ar 44100” = Die Ausgabefrequenz; im Beispiel 44100 Hz
  • “-r 25” = Die Bildrate; im Beispiel 25 Bilder/Sekunde
  • “-b 1000k” = Die Videobitrate; im Beispiel 1000 kbit/s
  • “beispiel.flv” = Die Ausgabedatei

Wer noch mehr wissen will “man ffmpeg” in der Shell eingeben.

Quelle: 3rd-party, Urheber unbekannt