Ticket #11545: default-permissions.diff

File default-permissions.diff, 1.5 KB (added by Michał Sałaban, 15 years ago)
  • docs/topics/auth.txt

     
    209209    .. method:: models.User.has_perm(perm)
    210210
    211211        Returns ``True`` if the user has the specified permission, where perm is
    212         in the format ``"<application name>.<lowercased model name>"``. If the
    213         user is inactive, this method will always return ``False``.
     212        in the format ``"<application name>.<permission name>"`` (see
     213        `permissions`_ section below). If the user is inactive, this method will
     214        always return ``False``.
    214215
    215216    .. method:: models.User.has_perms(perm_list)
    216217
     
    10851086    def limited_object_detail(*args, **kwargs):
    10861087        return object_detail(*args, **kwargs)
    10871088
     1089.. _permissions:
     1090
    10881091Permissions
    10891092===========
    10901093
     
    11141117Default permissions
    11151118-------------------
    11161119
     1120Three default permissions are named after the application and the model.
     1121Assuming you have ``foo`` application with ``Bar`` model, in order to test
     1122for basic permissions you should use:
     1123
     1124    * add: ``user.has_perm('foo.add_bar')``
     1125    * change: ``user.has_perm('foo.change_bar')``
     1126    * delete: ``user.has_perm('foo.delete_bar')``
     1127
    11171128When ``django.contrib.auth`` is listed in your :setting:`INSTALLED_APPS`
    11181129setting, it will ensure that three default permissions -- add, change and
    11191130delete -- are created for each Django model defined in one of your installed
Back to Top