Slide 16
Slide 16 text
PLUGIN
1. PLUGIN CLASS
class MyPlugin(CMSPluginBase):
name = _('My plugin')
model = MyPluginModel
render_template = 'myapp/myplugin.html'
def render(self, context, instance, placeholder):
newslist = News.objects.all().order_by('-date')
context.update({
'instance': instance,
'news_list': newslist[:instance.posts]
})
return context
Plugin = ModelAdmin + template + get_context_data