Skip to main content

get_permission_codename

Return the codename of the permission for the specified action.

def get_permission_codename(
action: string,
opts: object
) - > string

Return the codename of the permission for the specified action.

Parameters

NameTypeDescription
actionstringThe specific action or verb for the permission, such as 'add', 'change', or 'delete'.
optsobjectAn options object containing metadata about the model, specifically requiring a 'model_name' attribute.

Returns

TypeDescription
stringThe formatted permission string combining the action and the model name, typically used for Django-style permission checks.