Django-cms: Can't modify child plugins

Created on 18 Apr 2014  Â·  2Comments  Â·  Source: django-cms/django-cms

I have 2 plugins:
— LocationPlugin
— MapPlugin

Using ...

Django==1.6.2
django-cms==3.0

models.py

class Map(CMSPlugin):
    ZOOM_LEVELS = map(lambda c: (c, str(c)), range(22))

    title = models.CharField(
        _('Map Title'), max_length=100, blank=True, null=True)
    width = models.CharField(
        _('Width'), max_length=10, default='100%',
        help_text=_('Map width (in pixels or percent).'))
    height = models.CharField(
        _('Height'), max_length=10, default='400px',
        help_text=_('Map height (in pixels).'))
class Location(CMSPlugin):
    name = models.CharField(_('Name'), max_length=255)
    street_address = models.CharField(_('Address'), max_length=150)
    locality = models.CharField(_('City/Town'), max_length=100, blank=True)
    region = models.CharField(
        _('Region'), max_length=100, blank=True, null=True)
    postal_code = models.CharField(_('Postal Code'), max_length=30)
    country_short = models.CharField(
        _('Country'), max_length=255, choices=COUNTRIES)
    lat = models.CharField(
        _('Latitude'), max_length=100, null=True, blank=True)
    lng = models.CharField(
        _('Longitude'), max_length=100, null=True, blank=True,
        help_text=_('Use latitude & longitude to fine tune the map position.'))

cms_plugins.py

class LocationPlugin(CMSPluginBase):
    model = Location
    module = _('Locations')
    name = _('Location')
    render_template = 'cms/plugins/map/location.html'


plugin_pool.register_plugin(LocationPlugin)


class MapPlugin(CMSPluginBase):
    model = Map
    module = _('Locations')
    name = _('Map')
    render_template = 'cms/plugins/map/default.html'
    allow_children = True


plugin_pool.register_plugin(MapPlugin)

So nothing special. However after adding a child 'Location' plugin to 'Map' plugin .. I can't modify the child 'Location' plugin. When I click on the 'Location' plugin .. it loads up the parent 'Map' plugin

![screen shot 2014-04-18 at 01 07 42]

(https://cloud.githubusercontent.com/assets/1264089/2738378/97acaaf0-c68d-11e3-8423-10c74cc9247f.png)

As shown on the screenshot, for the 'Location' plugin 'cms_submenu' is not shown.
There are no js errors.

Most helpful comment

{% for plugin in instance.child_plugin_instances %}
    {% render_plugin plugin %}
{% endfor %}

I forgot to add the above to 'map' plugin template

All 2 comments

{% for plugin in instance.child_plugin_instances %}
    {% render_plugin plugin %}
{% endfor %}

I forgot to add the above to 'map' plugin template

Great man you save me a lot of debugging. Thanks ;)

Was this page helpful?
0 / 5 - 0 ratings