Skip to content
This repository has been archived by the owner on Oct 29, 2019. It is now read-only.

Search data won`t be updated for specific plugins without context #500

Open
DDshka opened this issue Aug 17, 2018 · 0 comments
Open

Search data won`t be updated for specific plugins without context #500

DDshka opened this issue Aug 17, 2018 · 0 comments

Comments

@DDshka
Copy link

DDshka commented Aug 17, 2018

Introduction:
Aldryn_newsblog gets all plugins inside article content placeholder and renders them programatically. As they are rendered application clears content from html tags and adds it to field 'search_data' of Article model.

The problem:
To render a plugin the application actually simulates circumstances to render it. So they need a request and its context. But aldryn_newsblog uses default context without any processing according to the users settings. In this case, all plugins which depend on users context processors, which add additional info to context, just cant be rendered. (e.g. sekizai tags)

To see the bug (using aldryn_newsblog v. 2.1.1):

  1. In application settings enable search data upadting with: ALDRYN_NEWSBLOG_UPDATE_SEARCH_DATA_ON_SAVE = True
  2. Create an article.
  3. Add Google maps plugin (it`s template using sekizai tags)
  4. Try to save.

Test project with the issue. (Check "readme")

One of the possible solutions is to simulate context processing like:

from django.utils.module_loading import import_string
    for processor in settings.TEMPLATES[0]['OPTIONS']['context_processors']:
        func = import_string(processor)
        context.update(func(request))

in /aldryn_newsblog/utils/utilities.py:115

But the solution is up to you.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant