Opened 8 years ago
Last modified 4 years ago
#26756 new Bug
Changing of model's verbose_name does not change the names of the model's permissions — at Initial Version
Reported by: | Dmitry Burakov | Owned by: | nobody |
---|---|---|---|
Component: | contrib.auth | Version: | dev |
Severity: | Normal | Keywords: | permissions verbose_name migrate |
Cc: | Triage Stage: | Accepted | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | yes |
Easy pickings: | no | UI/UX: | no |
Description
I've found that changing the "verbose_name" of the Meta class of a model and than running migrations does not change the names of the model's permissions.
Steps to reproduce:
- Create a new model
class AwesomeModel(models.Model): class Meta: verbose_name = "My awesome model"
- Run "makemigrations" and than "migrate"
- Look at the generated permissions
select * from auth_permission; id | name | content_type_id | codename -----+----------------------------------------+-----------------+---------------------------------- 1 | Can add my awesome model | 2 | add_awesomemodel 2 | Can change my awesome model | 2 | change_awesomemodel 3 | Can delete my awesome model | 2 | delete_awesomemodel
- Change the "verbose_name" of the Meta class of the model
class AwesomeModel(models.Model): class Meta: verbose_name = "My really awesome model"
- Run "makemigrations" and than "migrate" again
- Look at the generated permissions agaun
select * from auth_permission; id | name | content_type_id | codename -----+----------------------------------------+-----------------+---------------------------------- 1 | Can add my awesome model | 2 | add_awesomemodel 2 | Can change my awesome model | 2 | change_awesomemodel 3 | Can delete my awesome model | 2 | delete_awesomemodel
As you can see the names of the model's permissions are not changed.
But! If now you drop the database and apply all the migrations to the empty database - the permissions will have correct names
select * from auth_permission; id | name | content_type_id | codename -----+----------------------------------------+-----------------+---------------------------------- 1 | Can add my really awesome model | 2 | add_awesomemodel 2 | Can change really my awesome model | 2 | change_awesomemodel 3 | Can delete really my awesome model | 2 | delete_awesomemodel
Note:
See TracTickets
for help on using tickets.