[Answer]-Django cms display plugin data in template

1👍

To get the latest event, you can override the render method of your plugin:

class YourCMSPlugIn(CMSPluginBase):
    model = Event
    ...

    def render(self, context, instance, placeholder):
        context.update({
            'latest_event': self.model.objects.all()[:1],
            'placeholder': placeholder
        })

        return context

See: http://docs.django-cms.org/en/latest/extending_cms/custom_plugins.html#storing-configuration for more information.

Leave a comment