Permalink
Browse files

docs

  • Loading branch information...
1 parent cdd063d commit 57b513e4d3f64ad61b10d06da38a86a5a575f015 @digi604 committed Apr 9, 2013
Showing with 31 additions and 0 deletions.
  1. +31 −0 docs/extending_cms/placeholders.rst
@@ -41,6 +41,9 @@ placeholder. The configuration is the same as for placeholders in the CMS.
``'+'`` to allow the cms to check permissions properly. Attempting to do
so will raise a :exc:`ValueError`.
+Admin Integration
+=================
+
If you install this model in the admin application, you have to use
:class:`~cms.admin.placeholderadmin.PlaceholderAdmin` instead of
:class:`~django.contrib.admin.ModelAdmin` so the interface renders
@@ -52,6 +55,31 @@ correctly::
admin.site.register(MyModel, PlaceholderAdmin)
+
+I18N Placeholders
+=================
+
+Out of the box :class:`~cms.admin.placeholderadmin.PlaceholderAdmin` supports multiple languages and will
+display language tabs. If you extend `PlaceholderAdmin` and overwrite `change_form_template` be sure to have a look at
+'admin/placeholders/placeholder/change_form.html' on how to display the language tabs.
+
+If you need other fields then the placeholders translated as well: django CMS has support for `django-hvad`_. If you
+use a `TranslatableModel` model be sure to not include the placeholder fields in the translated fields::
+
+ class MultilingualExample1(TranslatableModel):
+ translations = TranslatedFields(
+ title=models.CharField('title', max_length=255),
+ description=models.CharField('description', max_length=255),
+ )
+ placeholder_1 = PlaceholderField('placeholder_1')
+
+ def __unicode__(self):
+ return self.title
+
+
+Templates
+=========
+
Now to render the placeholder in a template you use the
:ttag:`render_placeholder` tag from the
:mod:`~cms.templatetags.placeholder_tags` template tag library:
@@ -128,3 +156,6 @@ admin page with at least one :class:`~cms.models.fields.PlaceholderField`:
:class:`~cms.models.fields.PlaceholderField` per fieldset.
2. You **must** include the following two classes: ``'plugin-holder'`` and
``'plugin-holder-nopage'``
+
+
+.. _django-hvad: https://github.com/kristianoellegaard/django-hvad

0 comments on commit 57b513e

Please sign in to comment.