MCPcopy
hub / github.com/django/django / has_delete_permission

Method has_delete_permission

django/contrib/admin/options.py:630–643  ·  view source on GitHub ↗

Return True if the given request has permission to delete the given Django model instance, the default implementation doesn't examine the `obj` parameter. Can be overridden by the user in subclasses. In such case it should return True if the given request ha

(self, request, obj=None)

Source from the content-addressed store, hash-verified

628 return request.user.has_perm("%s.%s" % (opts.app_label, codename))
629
630 def has_delete_permission(self, request, obj=None):
631 """
632 Return True if the given request has permission to delete the given
633 Django model instance, the default implementation doesn't examine the
634 `obj` parameter.
635
636 Can be overridden by the user in subclasses. In such case it should
637 return True if the given request has permission to delete the `obj`
638 model instance. If `obj` is None, this should return True if the given
639 request has permission to delete *any* object of the given type.
640 """
641 opts = self.opts
642 codename = get_permission_codename("delete", opts)
643 return request.user.has_perm("%s.%s" % (opts.app_label, codename))
644
645 def has_view_permission(self, request, obj=None):
646 """

Callers 10

get_formsetMethod · 0.45
formfield_for_dbfieldMethod · 0.45
get_inline_instancesMethod · 0.45
get_model_permsMethod · 0.45
render_change_formMethod · 0.45
get_inline_formsetsMethod · 0.45
_delete_viewMethod · 0.45
user_deleted_formMethod · 0.45
has_delete_permissionMethod · 0.45
format_callbackFunction · 0.45

Calls 2

get_permission_codenameFunction · 0.90
has_permMethod · 0.45

Tested by

no test coverage detected