divio / aldryn-search

Haystack 2.0 search index for django CMS
Other
48 stars 77 forks source link

Context does not persist when rendering plugins #73

Open czpython opened 7 years ago

czpython commented 7 years ago

Some plugins rely on context variables set by their parent's render() method, because of how plugins are rendered here, the context is always new instead of being shared by plugins, thus these plugins fail to render correctly.

SteinRobert commented 7 years ago

Same with divio/djangocms-video#31

I had the thought that we could override the search_fields in the VideoSourcePlugin and VideoTrackPlugin. However this will not work with aldryn-search either because at the following line you are trying to access search_fields on the instance: https://github.com/aldryn/aldryn-search/blob/master/aldryn_search/helpers.py#L48

According to your documentation search_fields is a part of CMSPluginBase and not of the instances: http://docs.django-cms.org/en/release-3.4.x/how_to/custom_plugins.html

So I think you probably should change the above mentioned line to: search_fields = getattr(plugin_type, 'search_fields', [])

Not sure if my thoughts on this are right. However if you agree I can propose a PR.

FinalAngel commented 7 years ago

@czpython any chance you could pick this up at some point?

DmytroLitvinov commented 5 years ago

Hello @FinalAngel @czpython . Any chance to fix that? How can I help you?

FinalAngel commented 5 years ago

@DmytroLitvinov I sadly now not too much about this addon, we welcome PR's but I'm currently focusing on Django 2.2 support on the core addons.