在Django中添加新的自定义权限 [英] Adding new custom permissions in Django

查看:270
本文介绍了在Django中添加新的自定义权限的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在Django模型中使用自定义权限:

I am using custom permissions in my Django models like this:

class T21Turma(models.Model):
    class Meta:
        permissions = (("can_view_boletim", "Can view boletim"),
                       ("can_view_mensalidades", "Can view mensalidades"),)

问题是当我向列表添加权限时,它不会添加到 auth_permission 表,当我运行syncdb。我究竟做错了什么。如果有任何差异,我正在使用南方进行数据库迁移。

The problem is that when I add a permission to the list it doesn't get added to the auth_permission table when I run syncdb. What am I doing wrong. If it makes any difference I am using south for database migrations.

推荐答案

南方不追踪django.contrib.auth权限。有关详细信息,请参阅门票#211

South does not track django.contrib.auth permissions. See ticket #211 for more information.

票的评论之一表明,在syncdb上使用 - all 选项可以解决问题。

One of the comments on the ticket suggests that using the --all option on syncdb may solve the problem.

这篇关于在Django中添加新的自定义权限的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆