How do I access the request object in a Django-CMS plugin? How do I access the request object in a Django-CMS plugin? django django

How do I access the request object in a Django-CMS plugin?


The CMSPluginBase's render method takes a context object. You should be able to access the request via that object if your view is using a RequestContext instance.

class MyCoolPlugin(CMSPluginBase):    def render(self, context, instance, placeholder):         #Do something with the request, like access the user         current_user = context['request'].get('user', None)         ...