Django-cms: render_placeholder doesn't work?

Created on 14 Jul 2015  路  6Comments  路  Source: django-cms/django-cms

Using django-cms 3.1.2, Django 1.8.2 and Python 3.4.3, I can see the CMS toolbar and log in and edit a standard placeholder on /?edit, but there's no rendered output for {% render_placeholder my_instance.placeholder_field %} on my app's /my-view/?edit (toolbar still working there). Even no error in runserver.

needs more info

Most helpful comment

@furiousdave yes, placeholderfields on existing objects are created only after saving the object once.
I feel this should go into documentation

All 6 comments

@garncarz I cant reproduce this.
Could you provide more information on your current setup?

I just followed https://django-cms.readthedocs.org/en/latest/how_to/placeholders.html and it doesn't work... if I have a{% render_placeholder my_instance.placeholder_field %}b in my template, it renders a, several empty lines and b in HTML output. No error message provided in the console when using runserver.

Isn't there some better example of how to use that render_placeholder?

@garncarz you can check django cms applications like https://github.com/aldryn/adryn-newsblog or https://github.com/nephila/djangocms-blog to see examples of how to implement placeholder fields

@garncarz Not sure but this may be the same as an issue I came across. When I added a new PlaceholderField to an existing model I had and migrated, I was unable to view it on any of my objects in the frontend using render_placeholder. After lots of reverting, cache clearing, trying different things, etc, I created a new object and realized the field appeared on that one, just not objects that existed before the migration. After that, I went into shell and just "for obj in mymodel.objects.all(): obj.save()" and voila. Working PlaceholderField.

@furiousdave yes, placeholderfields on existing objects are created only after saving the object once.
I feel this should go into documentation

Nice find @furiousdave. I was digging for quite a while to determine what was happening here.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

quiqueporta picture quiqueporta  路  8Comments

AhmedSalam22 picture AhmedSalam22  路  5Comments

SteinRobert picture SteinRobert  路  3Comments

koslib picture koslib  路  9Comments

mireq picture mireq  路  8Comments