それは古いです - 適切な権限を持つこの抽象モデルを検討し
(ジャンゴ1.9)は、所望の動作は今箱から出して働いている - しかし、今後の参考のために:
class DetailContentLifecycleClassModel (models.Model):
class Meta:
abstract=True
permissions = (
('can_change_content', 'Change content of the model'),
('can_submit_for_approval', 'Ask for final check and publishing'),
('can_publish_content', 'Publish the model as a new version'),
)
をこれを継承する:
class Test_Details (DetailContentLifecycleClassModel):
name = models.CharField(max_length=200)
class Test_Details2 (DetailContentLifecycleClassModel):
name = models.CharField(max_length=200)
Permissionsは次のように作成されます。 G:
from playground.models import Test_Details
from django.contrib.auth.models import User, Permission
tmp = Permission.objects.filter()
結果(たかったまさにです):これを行うの
playground | test_ details | Can add test_ details
playground | test_ details | Change content of the model
playground | test_ details | Publish the model as a new version
playground | test_ details | Ask for final check and publishing
playground | test_ details | Can change test_ details
playground | test_ details | Can delete test_ details
playground | test_ details2 | Can add test_ details2
playground | test_ details2 | Change content of the model
playground | test_ details2 | Publish the model as a new version
playground | test_ details2 | Ask for final check and publishing
playground | test_ details2 | Can change test_ details2
playground | test_ details2 | Can delete test_ details2
これはまだ問題ですが、これより最近の人にとっては曖昧な肯定的なニュースは、この問題が6か月前にいくつかの作業を受けましたが、まだリリースには至っていません(そして1.10 .5執筆時点で)。 https://github.com/django/django/pull/6861#issuecomment-240427426 –