#274 closed defect (invalid)
data model permissions are only being added to 'auth_permissions' if custom permissions are also defined
Reported by: | Owned by: | Adrian Holovaty | |
---|---|---|---|
Component: | Tools | Version: | |
Severity: | normal | Keywords: | permissions, database, tables, data model |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
(The following is adapted from an email I posted to the user group mail list here: http://groups-beta.google.com/group/django-users/browse_frm/thread/73bfc859841b8db1 )
There is a discrepancy between the permissions and the data
inserted into the permissions table. It *seems* the only
way to get permissions to populate the table properly is to define your
own. As soon as you define a permission of your own, and then run the
command
django-admin.py install <your app>
the auto-generated perms + your custom perm get added to the proper
table in the database.
For instance, in your Poll class, add the following line:
permissions = (("dummy", "Dummy permission"),)
and then run
django-admin.py install polls
After install
runs, you should see the three automatic/intrinsic perms as well as
your custom dummy permission. If this procedure is not performed (i.e., no custom permission is defined in the data model, the auth_permissions
table does not get populated with the app's automatic permissions.
Permissions are only created in the
auth_permissions
table if a given model has anadmin
parameter set.