Test the plugin Now you can restart the runserver (required because you added the new cms_plugins.py file would be useful to restrict this to pages that are actually relevant. The first thing to add is a test right at the start of the populate() method: def populate(self): if not self.is_current_app: return shell >>> from importlib import import_module >>> m = import_module("myapp.cms_plugins") >>> m.some_test_function() Storing configuration In many cases, you want to store configuration for your plugin instances
0 码力 | 298 页 | 1.79 MB | 6 月前
3
  • epub文档 django cms 3.4.x Documentation

    configuration Serve multiple languages Work with templates Extend Page & Title models Extend the Toolbar Test your extensions Use placeholders outside the CMS Manage caching Enable frontend editing for Page and shell >>> from importlib import import_module >>> m = import_module("myapp.cms_plugins") >>> m.some_test_function() Storing configuration In many cases, you want to store configuration for your plugin ugettext_lazy as _ from cms.menu_bases import CMSAttachMenu class TestMenu(CMSAttachMenu): name = _("test menu") def get_nodes(self, request): nodes = [] n = NavigationNode(_('sample root
    0 码力 | 395 页 | 1.64 MB | 1 年前
    3
  • 共 535 条前往