def remove_mentor_from_project( request, **kwargs ): mentor = get_object_or_404( User, pk = kwargs['mentor'] ) project = get_object_or_404( Project, pk = kwargs['project'] ) if( (not PermissionHandler.remove_mentor_from_project( request.user, **kwargs )) ): # check for permission using the permissions module. dajax = Dajax() dajax.alert('You do NOT have this permission') return dajax.json() if mentor in project.mentors.all(): project.mentors.remove( mentor ) else: raise ValueError('User does not belong to this project') dajax = Dajax() dajax.script('location.reload(true)') return dajax.json()