1
In a recent project, I think I solved this with a context_processor as follows:
from django.conf import settings
def page_extension(request):
"""Puts settings.DEBUG and the page_extension, if present and puts it into
the context"""
context = {'debug': settings.DEBUG}
if request.current_page:
page = request.current_page
try:
context.update({'page_extension': page.page_extension})
except:
try:
context.update({'page_extension': page.publisher_public.page_extension})
except:
pass
return context
In this case, I’ve also used the opportunity to also add the value of settings.DEBUG, this is optional of course.
Then, just add this to your settings file as:
TEMPLATE_CONTEXT_PROCESSORS = (
...
'path.to.above.code.page_extension',
)
Then, next step, is just access the value in your templates:
{% if page_extension and page_extension.my_page_property %}{{ page_extension.my_page_property }}{% endif %}
0
First thing, if you are starting out the new project, go for django cms 3.0
, it has lots of new and exciting features than the previous release.
Back to your question, go to the advanced settings of the page which contains the actual image field and add the id. Then on other page do like this:
{% page_attribute "field_name" "my_page_reverse_id" %}
Source:stackexchange.com