permissions for adding a poll

7 views
Skip to first unread message

Mookai

unread,
Jul 30, 2005, 4:57:13 PM7/30/05
to Django users
I'm strugling with the permissions that users have in the admin. When
running the tutorial and creating the poll application every user that
has admin rights can add and delete polls. In de user settings I can
add en remove general privileges but not the poll privileges. Can I add
that, or is het not working because of a bug? (I do not believe it
isn't implemented, because that would be stupid at the least I guess)

oubiwann

unread,
Aug 4, 2005, 5:02:54 PM8/4/05
to Django users
Permissions are automatically generated with each data model. What you
have discovered is a discrepancy between the permissions and the data
inserted into the permissions table. I haven't yet checked their
tracker to see if it's a registered bug or not, but 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

(you will first have to delete the polls table). After the install
runs, you should see the three automatic/intrinsic perms as well as
your custom dummy permission.

oubiwann

unread,
Aug 4, 2005, 5:15:59 PM8/4/05
to Django users
I have submitted a ticket for this, as a search on their tracker didn't
turn anything up.

http://code.djangoproject.com/ticket/274

Adrian Holovaty

unread,
Aug 4, 2005, 11:22:34 PM8/4/05
to django...@googlegroups.com
On 8/4/05, oubiwann <duncan.m...@gmail.com> wrote:
> Permissions are automatically generated with each data model. What you
> have discovered is a discrepancy between the permissions and the data
> inserted into the permissions table.

Permissions are only created in the auth_permissions table if a given
model has an "admin" parameter set. If a model doesn't have an admin,
Django doesn't bother creating the permissions.

Adrian

oubiwann

unread,
Aug 5, 2005, 12:00:45 AM8/5/05
to Django users
Aha... interesting. I must have run 'django-admin.py install' against
an early version of the model before I added the 'admin =
meta.Admin(...' code. Completely overlooked that possibility. Thanks!

Reply all
Reply to author
Forward
0 new messages