Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

News and events templatetags #73

Open
darbula opened this Issue · 5 comments

2 participants

@darbula

News and events template tags are not working. There are few issues. First one is that work_out_entity on this line cannot be imported it should be uncommented and with full path:

from contacts_and_people.templatetags.entity_tags import work_out_entity

Another problem is on the next import CMSNewsAndEventsPlugin and this is the relevant (last) part of the traceback:

File "...env\src\arkestra\news_and_events\templatetags\news_and_events_tags.py", line 4, in <module>
 from news_and_events.cms_plugins import CMSNewsAndEventsPlugin
File "...env\src\arkestra\news_and_events\cms_plugins.py", line 9, in <module>
 from arkestra_utilities.admin_mixins import AutocompleteMixin
File "...env\src\arkestra\arkestra_utilities\admin_mixins.py", line 8, in <module>
  from widgetry.tabs.placeholderadmin import ModelAdminWithTabsAndCMSPlaceholder
File "...env\src\django-widgetry\widgetry\tabs\placeholderadmin.py", line 2, in <module>
 from cms.admin.placeholderadmin import PlaceholderAdmin
File "...env\lib\site-packages\cms\admin\__init__.py", line 2, in <module>
 import pageadmin
File "...env\lib\site-packages\cms\admin\pageadmin.py", line 1468, in <module>
 contribute_fieldsets(PageAdmin)
File "...env\lib\site-packages\cms\admin\pageadmin.py", line 98, in contribute_fieldsets
 if menu_pool.get_menus_by_attribute("cms_enabled", True):
File "...env\lib\site-packages\menus\menu_pool.py", line 183, in get_menus_by_attribute
 self.discover_menus()
File "...env\lib\site-packages\menus\menu_pool.py", line 74, in discover_menus
 load('menu')
File "...env\lib\site-packages\cms\utils\django_load.py", line 42, in load
 get_module(app, modname, verbose, failfast)
File "...env\lib\site-packages\cms\utils\django_load.py", line 21, in get_module
 module = import_module(module_name)
File "...env\lib\site-packages\django\utils\importlib.py", line 35, in import_module
 __import__(name)
File "...env\src\arkestra\arkestra_utilities\menu.py", line 26, in <module>
 menu["cms_plugin_model"] = getattr(plugin, menu["cms_plugin_model_name"])
AttributeError: 'module' object has no attribute 'CMSNewsAndEventsPlugin'

It seems that the name CMSNewsAndEventsPlugin from the module ...env\src\arkestra\news_and_events\cms_plugins.py is needed while the same module is still importing its dependencies (line 9).

@evildmp
Owner

Are you trying to use {% news_and_events %}? That's the only thing there that's interested in work_out_entity. And unless you really, really want to use {% news_and_events %}, my suggestion would be to get rid of the news_and_events() inclusion tag altogether.

It's not used anywhere in Arkestra itself, any more. Do you have a template that needs to use the tag?

@darbula

Yes I'm using {% news_and_events %} the other approach is to use plugin but I like tag better. For now I solved work_out_entity by uncommenting import line and giving the full path, that is from contacts_and_people.templatetags.entity_tags import work_out_entity.

Second, circular dependency issue is avoided by importing CMSNewsAndEventsPlugin inside inclusion tags.

@evildmp
Owner

If you really have a use for it, I guess {% news_and_events %} is worth keeping.

@darbula

What is the alternative, except for using plugin in placeholder?

@evildmp
Owner

There is no alternative.

Be warned however that the code in https://github.com/evildmp/Arkestra/blob/develop/news_and_events/templatetags/news_and_events_tags.py#L11 is out of date.

For example, the current_or_archive attribute has been replaced with view, and takes different slightly values.

There's some explanation at https://arkestra.readthedocs.org/en/latest/using_arkestra/arkestra_generic_models.html#cms-plugins-py, but I really need to do some work on all this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.