def hide_activity(request): if not request.user.is_authenticated() and request.user.is_staff: raise PermissionDenied activity = Activity.objects.get(pk=request.POST['activity_id']) activity.active = False activity.save() return HttpResponse('OK')