docs: def toggle_pause(request):
      """Allow the user to pause and unpause the active entry."""
      entry = utils.get_active_entry(request.user)
      if not entry:
          raise Http404
  
      # toggle the paused state
      entry.toggle_paused()
      entry.save()
  
      # create a message that can be displayed to the user
      action = 'paused' if entry.is_paused else 'resumed'
      message = 'Your entry, {0} on {1}, has been {2}.'.format(
          entry.activity.name, entry.project, action)
      messages.info(request, message)
  
      # redirect to the log entry list
      return HttpResponseRedirect(reverse('dashboard'))