Where exactly in the django source code, the default permissions are created?

34 views
Skip to first unread message

Fabio C. Barrionuevo da Luz

unread,
Dec 19, 2013, 2:16:45 PM12/19/13
to django...@googlegroups.com
Hello guys, I'm trying to understand the inner workings of the permissions django system.

My question is where exactly in the django source code, the default permissions are created?


--
Fábio C. Barrionuevo da Luz
Acadêmico de Sistemas de Informação na Faculdade Católica do Tocantins - FACTO
Palmas - Tocantins - Brasil - América do Sul

C. Kirby

unread,
Dec 19, 2013, 4:27:57 PM12/19/13
to django...@googlegroups.com
https://github.com/django/django/blob/master/django/contrib/auth/models.py

Take a look at the classes Permission, PermissionMixin and AbstractUser

Fabio Caritas Barrionuevo da Luz

unread,
Dec 20, 2013, 11:40:31 AM12/20/13
to django...@googlegroups.com
Have had looked Those classes, However, Still Could Not see Which line or lines in the source code the default permissions are created.

Is there anybody from the Core Developers that could explain where exactly they are created?


Sorry for English, I speak Portuguese, it was translated by Google Translator. 
Not the best thing in the world, but it works minimally, while also study the English language.

Felipe Coelho

unread,
Dec 20, 2013, 12:02:40 PM12/20/13
to Django users
2013/12/19 Fabio C. Barrionuevo da Luz <bna...@gmail.com>

Hello guys, I'm trying to understand the inner workings of the permissions django system.

My question is where exactly in the django source code, the default permissions are created?

Default permissions are created by django.contrib.auth.management.create_permissions [1], which is called by the post_syncdb signal [2]

Fabio Caritas Barrionuevo da Luz

unread,
Dec 20, 2013, 12:32:42 PM12/20/13
to django...@googlegroups.com
Thanks Felipe, this is exactly what I was looking for.
My goal is to create a new default permission for all my models without having to declare it explicitly at all.

It would be something like:
permissions = (
             ('view_model_class_name', _ ('View model_class_name')),
)

I wonder why the developers chose to put the nucleus only the permissions add, change and delete and do not include default permission for display only.
Reply all
Reply to author
Forward
0 new messages