Class Permission
source code
db.models.Model --+
|
Permission
The permissions system provides a way to assign permissions to
specific users and groups of users.
The permission system is used by the Django admin site, but may also
be useful in your own code. The Django admin site uses permissions as
follows:
-
The "add" permission limits the user's ability to view the
"add" form and add an object.
-
The "change" permission limits a user's ability to view the
change list, view the "change" form and change an object.
-
The "delete" permission limits the ability to delete an
object.
Permissions are set globally per type of object, not per specific
object instance. It is possible to say "Mary may change news
stories," but it's not currently possible to say "Mary may
change news stories, but only the ones she created herself" or
"Mary may only change news stories that have a certain status or
publication date."
Three basic permissions -- add, change and delete -- are automatically
created for each Django model.
|
|
name = models.CharField(_('name'), max_length= 50)
|
|
|
content_type = models.ForeignKey(ContentType)
|
|
|
codename = models.CharField(_('codename'), max_length= 100)
|