Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

For loop over placeholder content Django CMS

I am trying to loop over a placeholder which returns for example: "word word word".

In my template I got this code:

 {% placeholder "categorie" as icon %}
 {% for i in icon.split %}
    <i class="{{ i }}"></i>
 {% endfor %}

However the as keyword is not working and the output is just the placeholder "word word word".

Am I missing something?

like image 593
Nielsen Ramon Avatar asked Mar 25 '26 04:03

Nielsen Ramon


1 Answers

Placeholders in Django-CMS are intended to render content plugins. You can alter the contents of a placeholder programmtically (see "Plugin Context Processors" for more), but you can't assign the content plugins contained within a placeholder using as to another variable.

They literally render their content plugins in the order that they appear in, top-down in Django admin for your model field.

like image 126
Brandon Avatar answered Mar 26 '26 20:03

Brandon



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!