docs: def shift_view(request, semester, pk, profile=None):
      """
      View the details of a particular RegularWorkshift.
      """
      shift = get_object_or_404(RegularWorkshift, pk=pk)
      page_name = shift.workshift_type.title
  
      if shift.is_manager_shift:
          president = Manager.objects.filter(
              incumbent__user=request.user,
              president=True,
          ).count() > 0
          can_edit = request.user.is_superuser or president
      else:
          can_edit = utils.can_manage(
              request.user,
              semester=semester,
              pool=shift.pool,
          )
  
      instances = WorkshiftInstance.objects.filter(
          weekly_workshift=shift,
          date__gte=localtime(now()).date(),
      )
      instance_tuples = [
          (
              instance,
              _get_forms(profile, instance, request, undo=can_edit),
          )
          for instance in instances
      ]
  
      # Save any forms that were submitted
      all_forms = [form for instance, forms in instance_tuples for form in forms]
      for form in all_forms:
          if form.is_valid():
              form.save()
              return HttpResponseRedirect(shift.get_view_url())
          else:
              for error in form.errors.values():
                  messages.add_message(request, messages.ERROR, error)
  
      return render_to_response("view_shift.html", {
          "page_name": page_name,
          "shift": shift,
          "instance_tuples": instance_tuples,
          "can_edit": can_edit,
      }, context_instance=RequestContext(request))