Update permissions on custom permissions migration

42 views
Skip to first unread message

Yo-Yo Ma

unread,
Mar 30, 2018, 5:43:39 PM3/30/18
to Django developers (Contributions to Django itself)
A model with a custom permission:

class Spam(Model):
    class Meta:
        permissions = (('spam', 'Can eat spam'),)


...

    $ manage.py makemigrations
    $ manage.py migrate


Now we have a custom permission in the User admin:

    foods | spam | Can eat spam


Then update the permission's verbose name:

class Spam(Model):
    class Meta:
        permissions = (('spam', 'Can cook AND eat spam'),)


...

    $ manage.py makemigrations
    $ manage.py migrate


The permission's description change is not reflected in the admin:

    foods | spam | Can eat spam

Yo-Yo Ma

unread,
Mar 30, 2018, 6:12:37 PM3/30/18
to Django developers (Contributions to Django itself)
FWIF, I wrote a custom data migration to update the Permission model.

My OP is attempting to suggest that migrations should handle this automatically.
Reply all
Reply to author
Forward
0 new messages