Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 4402fe20e0
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 27 lines (21 sloc) 0.834 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
from cms.plugin_pool import plugin_pool
from cms.plugin_base import CMSPluginBase
from cms.plugins.column.models import Column, ColumnPlaceholder
from django.contrib import admin
from django.utils.translation import ugettext_lazy as _

class PlaceholderInline(admin.TabularInline):
    model = ColumnPlaceholder


class ColumnPlugin(CMSPluginBase):
    model = Column
    name = _("Columns")
    render_template = "cms/plugins/column.html"
    inlines = [PlaceholderInline]
    frontend_edit_template = "cms/plugins/column_frontend_edit.html"

    def render(self, context, instance, placeholder):
        placeholders = instance.placeholder_inlines.all()
        context.update({
            'placeholders': placeholders,
            'instance': instance,
        })
        return context

plugin_pool.register_plugin(ColumnPlugin)
Something went wrong with that request. Please try again.