Reasons for why someone would want to do this aside, is it possible? Something along the lines of
from cms.plugin_base import CMSPluginBase
from data_viewer.models.data_view import DataPlugin
from django.http import HttpResponse
class CMSPlugin(CMSPluginBase):
def render(self, context, instance)
response = HttpResponse(content_type='text/csv')
return response
Usually render functions require a context to be returned, thus this code doesn't work as is. Once again, I know this isn't typical. I just want to know if it's possible
Thanks in advance, all help is appreciated!
In short: No.
The render method is very unfortunately named and should really be called get_context. It must return a dictionary or Context instance, see the docs
If you want to extend django CMS with something that returns HttpResponse objects, have a look at apphooks.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With