Ticket #11124: 11124-ModelAdmin_has_x_permission_docstrings-r10793.diff

File 11124-ModelAdmin_has_x_permission_docstrings-r10793.diff, 1.9 KB (added by Ramiro Morales, 15 years ago)
  • django/contrib/admin/options.py

    diff --git a/django/contrib/admin/options.py b/django/contrib/admin/options.py
    a b  
    272272
    273273    def has_change_permission(self, request, obj=None):
    274274        """
    275         Returns True if the given request has permission to change the given
    276         Django model instance.
     275        A subclass-provided version of this method can return True if the given
     276        request has permission to change the given Django model instance `obj`.
    277277
    278         If `obj` is None, this should return True if the given request has
    279         permission to change *any* object of the given type.
     278        If `obj` is None, it should return True if the given request has
     279        permission to change *any* object of the model associated with this
     280        ModelAdmin.  This default implementation does exactly that and simply
     281        ignores `obj`.
    280282        """
    281283        opts = self.opts
    282284        return request.user.has_perm(opts.app_label + '.' + opts.get_change_permission())
    283285
    284286    def has_delete_permission(self, request, obj=None):
    285287        """
    286         Returns True if the given request has permission to change the given
    287         Django model instance.
     288        A subclass-provided version of this method can return True if the given
     289        request has permission to delete the given Django model instance `obj`.
    288290
    289         If `obj` is None, this should return True if the given request has
    290         permission to delete *any* object of the given type.
     291        If `obj` is None, it should return True if the given request has
     292        permission to delete *any* object of the model associated with this
     293        ModelAdmin. This default implementation does exactly that and simply
     294        ignores `obj`.
    291295        """
    292296        opts = self.opts
    293297        return request.user.has_perm(opts.app_label + '.' + opts.get_delete_permission())
Back to Top