Skip to main content

auth.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.
  • The "view" permission limits the ability to view 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."

The permissions listed above are automatically created for each model.

Fields

Field Type Description
codename String (up to 100) codename
content_type ContentType

the related contenttypes.ContentType object

group_set.all List

all related auth.Group objects

group_set.count Integer

number of related auth.Group objects

id Integer ID
name String (up to 255) name
natural_key
user_set.all List

all related auth.User objects

user_set.count Integer

number of related auth.User objects

‹ Back to Model documentation