#25166 closed Cleanup/optimization (fixed)
Unclear statement in custom model permission documentation
Reported by: | Baptiste Mispelon | Owned by: | nobody |
---|---|---|---|
Component: | Documentation | Version: | 1.8 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Accepted | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | yes | UI/UX: | no |
Description (last modified by )
The custom permission documentation at https://docs.djangoproject.com/en/dev/topics/auth/default/#default-permissions states that after you add a custom permission to a model's Meta
:
it will create default permissions for new models each time you run manage.py migrate.
This is incorrect. What actually happens is that Django will detect the changes to the model's Meta
and generate the appropriate migration for it when running makemigrations
.
Attachments (1)
Change History (8)
comment:1 by , 9 years ago
Description: | modified (diff) |
---|
comment:2 by , 9 years ago
comment:3 by , 9 years ago
Ah, that explains it.
I was trying to create a data migration alongside the auto-generated one and was confused as to why it wasn't working (Django was complaining that my custom permission didn't exist yet).
The documentation is technically correct I guess though I still find it pretty confusing.
I don't really have an idea on how to improve it though so I'd be OK if you just want to close this.
comment:4 by , 9 years ago
Has patch: | set |
---|---|
Summary: | Incorrect statement in custom model permission documentation → Unclear statement in custom model permission documentation |
Triage Stage: | Unreviewed → Accepted |
Type: | Bug → Cleanup/optimization |
Here's a try.
by , 9 years ago
Attachment: | 25166.diff added |
---|
comment:5 by , 9 years ago
That's pretty good I think. Can we also add this sentence to the paragraph under the code at https://docs.djangoproject.com/en/dev/topics/auth/customizing/#custom-permissions?
Thanks.
The statement is still true as the permissions are created by
create_permissions()
which is connected to thepost_migrate
signal. The migration that's generated doesn't have any effect data-wise. Do you think this needs to be clarified?