在Django CMS中缺少可以查看页面权限

时间:2014-04-04 17:54:56

标签: python django django-cms

我需要为django CMS添加仅查看设置。但我发现它在我的设置中丢失了。这是一个截图

enter image description here

它具有cms | pagina | Can view page设置以外的所有其他设置。我尝试通过添加

来修复它
CMS_PUBLIC_FOR = 'all'
CMS_PERMISSION = True

这是更多信息。当我检查root用户的所有权限时,我发现该权限丢失。

u'cms.add_cmsplugin',
u'cms.add_file',
u'cms.add_flash',
u'cms.add_globalpagepermission',
u'cms.add_googlemap',
u'cms.add_link',
u'cms.add_page',
u'cms.add_pagemoderator',
u'cms.add_pagemoderatorstate',
u'cms.add_pagepermission',
u'cms.add_pageuser',
u'cms.add_pageusergroup',
u'cms.add_placeholder',
u'cms.add_snippet',
u'cms.add_snippetptr',
u'cms.add_teaser',
u'cms.add_title',
u'cms.add_twitterrecententries',
u'cms.add_video',
u'cms.change_cmsplugin',
u'cms.change_file',
u'cms.change_flash',
u'cms.change_globalpagepermission',
u'cms.change_googlemap',
u'cms.change_link',
u'cms.change_page',
u'cms.change_pagemoderator',
u'cms.change_pagemoderatorstate',
u'cms.change_pagepermission',
u'cms.change_pageuser',
u'cms.change_pageusergroup',
u'cms.change_placeholder',
u'cms.change_snippet',
u'cms.change_snippetptr',
u'cms.change_teaser',
u'cms.change_title',
u'cms.change_twitterrecententries',
u'cms.change_video',
u'cms.delete_cmsplugin',
u'cms.delete_file',
u'cms.delete_flash',
u'cms.delete_globalpagepermission',
u'cms.delete_googlemap',
u'cms.delete_link',
u'cms.delete_page',
u'cms.delete_pagemoderator',
u'cms.delete_pagemoderatorstate',
u'cms.delete_pagepermission',
u'cms.delete_pageuser',
u'cms.delete_pageusergroup',
u'cms.delete_placeholder',
u'cms.delete_snippet',
u'cms.delete_snippetptr',
u'cms.delete_teaser',
u'cms.delete_title',
u'cms.delete_twitterrecententries',
u'cms.delete_video',
u'cms.publish_page',}

但未能解决问题。我不确定调试它的好方法是什么。提前谢谢。

1 个答案:

答案 0 :(得分:3)

这是我在https://djangosnippets.org/snippets/698/

找到的简单解决方案

#添加任何缺少的权限

from django.contrib.auth.management import create_permissions
from django.db.models import get_apps
for app in get_apps():
    create_permissions(app, None, 2)

这将获得缺少的剩余权限。