def add_permission_view_menu(self, permission_name, view_menu_name):
if not (permission_name and view_menu_name):<EOL><INDENT>return None<EOL><DEDENT>pv = self.find_permission_view_menu(<EOL>permission_name,<EOL>view_menu_name<EOL>)<EOL>if pv:<EOL><INDENT>return pv<EOL><DEDENT>vm = self.add_view_menu(view_menu_name)<EOL>perm = self.add_permission(permission_name)<EOL>pv = self.permissionview_model()<EOL>pv.view_menu, pv.permission = vm, perm<EOL>try:<EOL><INDENT>pv.save()<EOL>log.info(c.LOGMSG_INF_SEC_ADD_PERMVIEW.format(str(pv)))<EOL>return pv<EOL><DEDENT>except Exception as e:<EOL><INDENT>log.error(c.LOGMSG_ERR_SEC_ADD_PERMVIEW.format(str(e)))<EOL><DEDENT>
Adds a permission on a view or menu to the backend

:param permission_name:
    name of the permission to add: 'can_add','can_edit' etc...
:param view_menu_name:
    name of the view menu to add