Arkestra icon indicating copy to clipboard operation
Arkestra copied to clipboard

News and events templatetags

Open darbula opened this issue 12 years ago • 5 comments

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).

darbula avatar Mar 22 '13 21:03 darbula

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?

evildmp avatar Mar 22 '13 22:03 evildmp

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.

darbula avatar Mar 22 '13 23:03 darbula

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

evildmp avatar Mar 22 '13 23:03 evildmp

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

darbula avatar Mar 22 '13 23:03 darbula

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!

evildmp avatar Mar 23 '13 09:03 evildmp