Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#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 Tim Graham)

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)

25166.diff (756 bytes ) - added by Tim Graham 9 years ago.

Download all attachments as: .zip

Change History (8)

comment:1 by Tim Graham, 9 years ago

Description: modified (diff)

comment:2 by Tim Graham, 9 years ago

The statement is still true as the permissions are created by create_permissions() which is connected to the post_migrate signal. The migration that's generated doesn't have any effect data-wise. Do you think this needs to be clarified?

comment:3 by Baptiste Mispelon, 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 Tim Graham, 9 years ago

Has patch: set
Summary: Incorrect statement in custom model permission documentationUnclear statement in custom model permission documentation
Triage Stage: UnreviewedAccepted
Type: BugCleanup/optimization

Here's a try.

by Tim Graham, 9 years ago

Attachment: 25166.diff added

comment:5 by Baptiste Mispelon, 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.

comment:6 by Tim Graham <timograham@…>, 9 years ago

Resolution: fixed
Status: newclosed

In 217f173:

Fixed #25166 -- Clarified how auth permissions are created.

Thanks Baptiste Mispelon for report and review.

comment:7 by Tim Graham <timograham@…>, 9 years ago

In 19ac8b2:

[1.8.x] Fixed #25166 -- Clarified how auth permissions are created.

Thanks Baptiste Mispelon for report and review.

Backport of 217f173be025d2cce6484c760ea6ec77436f26a1 from master

Note: See TracTickets for help on using tickets.
Back to Top