1

My problem

With Django CMS 2.3.3, when creating a Page I use cmsplugin_picture* next to a couple of other cmsplugins. In my cms template, instead of doing:

{% placholder "content" %}  //calling the Django Page including all plugins...

I would like to call each cmsplugin seperately, but how would I do that? I looked at Django tag template (filters) here and also studied Django CMS template tags here, but neither seem to suggest that possibility. I have to say I am a beginner so I might not have connected the dots...

What I try to achieve:

In my template I have a IMG tag (outside of the {% placeholder "content" %} tag) which I want to populate with an image url that I define in my Page/cmsplugin_picture. So I am looking for a placeholder tag that allows me to grab that image. In my wildest dreams I would name it:

{% show_placeholder "content" request.current_page.get_cmsplugin_picture %}

Obviously the above doesn't work, but does something like this exist?

**I have also tried cmsplugin_filer, but to me it isn't necessarely more beneficial to fix this particular problem.*

EDIT: What I mean by Page/cmsplugin_picture -> In a Django CMS Page you can select between your installed cmsplugins to add to a Page. In my case I select cmsplugin_picture and upload an image (within that plugin). This image I want to 'call' in my Django Template. So it is a not a static url, but dynamic.

Tim Smith
  • 17
  • 4
  • I think I'm having trouble understanding the question. *"...that I define in my Page/cmsplugin_picture."* Do you want to hardcode the URL so that there's a default image in your image placeholder? – jamesplease Oct 29 '12 at 17:16
  • Thanks jmeas for your interest, I clarified the question. – Tim Smith Oct 30 '12 at 18:58

1 Answers1

0

You should make a second placeholder where your img tag is (and optionally limit the types and amount of plugins using CMS_PLACEHOLDER_CONF (http://docs.django-cms.org/en/2.3.3/getting_started/configuration.html#cms-placeholder-conf).

ojii
  • 4,729
  • 2
  • 23
  • 34
  • Great it works! Thanks ojii **Solution:** _In Settings.py_ `CMS_PLACEHOLDER_CONF = { 'pica': { "plugins": ['PicturePlugin'] }, } // creates new placeholder option in admin` _In my-template.html_ `{% placeholder 'pica' %} // displays full img tag` – Tim Smith Oct 31 '12 at 20:00