docs: def add_shift_view(request, semester):
      """
      View for the workshift manager to create new types of workshifts.
      """
      page_name = "Add Workshift"
      any_management = utils.can_manage(request.user, semester, any_pool=True)
  
      if not any_management:
          messages.add_message(
              request,
              messages.ERROR,
              MESSAGES["ADMINS_ONLY"],
          )
          return HttpResponseRedirect(semester.get_view_url())
  
      # Check what pools this person can manage
      pools = WorkshiftPool.objects.filter(semester=semester)
      full_management = utils.can_manage(request.user, semester=semester)
  
      if not full_management:
          pools = pools.filter(managers__incumbent__user=request.user)
  
      # Forms
      add_type_form = WorkshiftTypeForm(
          data=request.POST if "add_type" in request.POST else None,
          prefix="type",
      )
      shifts_formset = RegularWorkshiftFormSet(
          data=request.POST if "add_type" in request.POST else None,
          prefix="shifts",
          queryset=RegularWorkshift.objects.none(),
          pools=pools,
      )
  
      if add_type_form.is_valid() and shifts_formset.is_valid():
          wtype = add_type_form.save()
          shifts_formset.save(workshift_type=wtype)
          return HttpResponseRedirect(wurl(
              "workshift:manage",
              sem_url=semester.sem_url,
          ))
  
      add_instance_form = WorkshiftInstanceForm(
          data=request.POST if "add_instance" in request.POST else None,
          pools=pools,
          semester=semester,
      )
      if add_instance_form.is_valid():
          add_instance_form.save()
          return HttpResponseRedirect(wurl(
              "workshift:manage",
              sem_url=semester.sem_url,
          ))
  
      return render_to_response("add_shift.html", {
          "page_name": page_name,
          "add_type_form": add_type_form,
          "shifts_formset": shifts_formset,
          "add_instance_form": add_instance_form,
      }, context_instance=RequestContext(request))