There is a way to do this, although it may seem convoluted at first sight
Add the following code to the place where you create the ApplicationContent:
def get_admin_fields(form, *args, **kwargs):
return {
'exclusive_subpages': forms.BooleanField(
label=capfirst(_('exclusive subpages')),
required=False,
initial=form.instance.parameters.get('exclusive_subpages', False),
help_text=_('Exclude everything other than the
application\'s content when rendering subpages.'),
),
}
Page.create_content_type(ApplicationContent, APPLICATIONS=(
('content.news_urls', 'News Articles', {'admin_fields': get_admin_fields}),
)
Once you add the news articles to a page and reload the editor (save
and continue editing), you'll see an additional checkbox, "exclusive
subpages". Check this and save.
Next, add 'feincms.context_processors.appcontent_parameters' to your
TEMPLATE_CONTEXT_PROCESSORS. This will ensure that the templates know
the value of exclusive_subpages.
As the final step, replace your feincms_render_region call in your
base template with the following snippet:
{% block content %}
{% if exclusive_subpages and in_appcontent_subpage %}
{% feincms_render_region_appcontent feincms_page "main" request %}
{% else %}
{% feincms_render_region feincms_page "main" request %}
{% endif %}
{% endblock %}
Note that the value of in_appcontent_subpage is always determined by
feincms.views.applicationcontent.handler (resp. build_page_response)
This special use case could be made more simple of course. On the
other hand, it serves as a nice example how to customize application
contents from the administration interface.
Matthias
--
Matthias Kestenholz - Dipl. Umwelt-Natw. ETH - Konzept & Programmierung
FEINHEIT GmbH - Molkenstrasse 21 - CH-8004 Zürich
FeinCMS Django CMS building toolkit: http://www.feinheit.ch/labs/feincms/
This is about hiding content elements which are added before or after
an applicationcontent.
Your page might look like this:
1. RichTextContent: Blabla introduction blurb
2. ApplicationContent: News module
3. RichTextContent: Some additional information
However, on subpages you might want to hide the RichTextContents in
position 1 and 3. The snippets posted allow you to do this -- instead
of concatenating the output of all content blocks together, you only
get the content of the embedded detail view.
Matthias
Has the "appcontent_parameters" context processor been deprecated, if so, is there an alternative to this without writing your own solution?