6

I want to change the default permission name created by django after migrating django model.

The docs says Providing default_permissions = [] in the class Meta works but

It must be specified on the model before the model is created by migrate in order to prevent any omitted permissions from being created.

But is it possible to change the permission Name (codename also if possible) after the model migration also ?

 class ContactPage(models.Model):
        full_name = models.CharField(max_length=255)
        email = models.EmailField()
        msg = models.TextField()
        sent_on = models.DateTimeField(auto_now_add=True)

        def __str__(self):
            return self.full_name

        class Meta:
            default_permissions = [] # works in the first migrate
            permissions = [
                ('can_view_contacts', 'Can View Contacts'),
                ('can_delete_contacts', 'Can Delete Contacts'),
            ]
D_P
  • 802
  • 10
  • 32

1 Answers1

0

I did it by creating an empty migration file and doing the job manually in that.

Khai Hoan Pham
  • 86
  • 1
  • 2
  • 7