Remove (or hide) default Permissions from Django

前端 未结 8 1152
醉酒成梦
醉酒成梦 2021-01-30 17:53

I\'m developing a Django app that will have two administration backends. One for daily use by \"normal\" users and the default one for more advanced tasks and for the developers

8条回答
  •  清酒与你
    2021-01-30 18:32

    A new feature introduced in Django 1.7 is the ability to define the default permissions. As stated in the documentation if you set this to empty none of the default permissions will be created.

    A working example would be:

    class Blar1(models.Model):
        id = models.AutoField(primary_key=True)
        name = models.CharField(max_length=255, unique = True, blank = False, null = False, verbose_name= "Name")
    
        class Meta:
            default_permissions = ()
    

提交回复
热议问题