Django CMS周围的工具/助手
django-cms-tools的Python项目详细描述
现有材料
Django CMS插件
页面定位菜单
向CMS页面添加锚定菜单。 更多信息请访问: django_cms_tools/plugin_anchor_menu/readme.creole
登录页
创建登录页的应用程序。 有关详细信息,请访问:django cms tools/tree/master/django cms tools/plugin登录页;readme" rel="nofollow">django cms工具/plugin登录页/readme.creole
测试实用程序
添加CMS插件单元测试用例
django_cms_tools.unittest_utils.add_cms_plugin.testaddpluginestcase -testcase to test"add cms plugin via admin"
生成add cms plugin unittest骨架
<:< /P>$ ./manage.py generate_add_plugin_test_code plugin_anchor_menu.AnchorPlugin from django_cms_tools.unittest_utils.add_cms_plugin import TestAddPluginTestCase class AddPluginTestCase(TestAddPluginTestCase): """ Tests for plugin_anchor_menu.AnchorPluginModel Based on a skeleton generated via: ./manage.py generate_add_plugin_test_code plugin_anchor_menu.AnchorPlugin """ def test_anchorplugin_de_1(self): # plugin name in de: 'Anchor' self.create_plugin( language_code = "de", plugin_parent=None, plugin_type="AnchorPlugin", title='dummy text no. 0', # CharField, String (up to 254) slug='dummy-text-no-0', # SlugField, Slug (up to 255) ) response = self.assert_plugin( language_code="de", must_contain_html=[ "<XXX></XXX>", # TODO: Add plugin html output here! ], must_contain=[ "dummy text no. 0", ], template_name="anchor_menu/anchor.html", ) def test_anchorplugin_de_2(self): ...
显示CMS插件的用法
通过调用列出所有现有插件:
/manage.py list_page_by_插件
要显示CMS插件用法,请将插件名称添加为参数,例如:
/manage.py list_page_by_plugin文本插件
CMS相关测试资产
django_cms_tools.unittest_utils.assertments 包含与cms相关的测试资产:
- assert_public_cms_app_namespaces() -检查给定的命名空间是否存在。
- assert_public_cms_page_url() -检查给定的url是否存在。
测试夹具创建
django_cms_tools.fixtures.pages
在测试设备中创建django cms页面的帮助程序:
类 django_cms_tools.fixtures.pages.**cmspagecreator* 可用于创建普通/插件cms p年龄。 从类继承并根据需要覆盖属性/方法;) 例如,查看测试代码。
来源:django cms tools/fixtures/pages.py 测试/示例: /tests/test_fixtures_pages.py
创建CMS索引页
用所有现有语言( settings.languages )创建CMS主页,并用文本插件填充占位符,使用:
- django_cms_tools.fixtures.pages.**create_cms_index_pages*
创建CMS插件页
使用所有现有语言( settings.languages )创建CMS插件页,并添加到索引页的链接。
- django_cms_tools.fixtures.pages.**create_cms_plugin_page*
django文件管理器工具 实验性的
通过更改settings.py激活,例如:
INSTALLED_APPS = [ ... 'django_cms_tools.filer_tools', ... ]
"图像信息"管理命令
显示有关现有、丢失和忽略的图像数的信息。以及所有使用过的图像的摘要。 用法:
$ ./manage.py image_info 34 items - foo.Bar 34 instanced checked: 0 exist 0 missing 34 ignored - foo.BarModel.meta_image 34 exist 0 missing 0 ignored - foo.BarModel.filer_overview_image ... total: existing images..: 6171 missing images...: 0 ------------------------------------------------------------------------------- Collect all filer IDs... File: 2 entries Image: 2 entries Information about File: Total entry count: 8042 entries. Used entry count: 2 entries. Total size: 13.8 GB Used size: 997.5 KB Information about Image: Total entry count: 6993 entries. Used entry count: 2 entries. Total size: 13.7 GB Used size: 997.5 KB (Note: 'File' contains 'Image' ;)
"替换损坏的"管理命令
用给定的文件管理器ID替换所有不存在的文件。
例如:您希望复制现有安装,但不移动实际文件:
- 在源系统上生成数据库转储
- 插入数据库转储克隆的系统
- 登录新克隆版本的django管理员
- 上载"dummy.jpg"文件管理器图像
- 记下文件管理器映像ID(例如:123)
- 开始: $./manage.py replace_broken 123 < > >
文件管理器"导出文件管理器图像"管理命令
导出文件管理器映像 将所有使用过的文件管理器映像文件存储到磁盘。例如:
$ ./manage.py export_filer_images my_backups
"模板信息"管理命令
激活,例如:
INSTALLED_APPS = [ ... 'django_cms_tools', ... ]
它看起来像:
$ ./manage.py template_info There are 3 public pages: pk:1 /en/ /foo/homepage.html pk:2 /en/foo/ INHERIT pk:3 /en/foo/bar/ INHERIT
"cms_plugin_info"管理命令
激活,例如:
INSTALLED_APPS = [ ... 'django_cms_tools', ... ]
它看起来像:
$ ./manage.py cms_plugin_info There are 4 CMS plugins: 'Django CMS Tools Test' * RelatedPlugin (Related Plugin) 'Generic' * PlaceholderPlugin (Placeholder) * AliasPlugin (Alias) * TextPlugin (Text)