code: def edit_instance_view(request, semester, pk, profile=None):
      
      instance = get_object_or_404(WorkshiftInstance, pk=pk)
  
      if instance.weekly_workshift and instance.weekly_workshift.is_manager_shift:
          president = Manager.objects.filter(
              incumbent__user=request.user,
              president=True
          ).count() > 0
          can_edit = request.user.is_superuser or president
          message = MESSAGES["PRESIDENTS_ONLY"]
      else:
          can_edit = utils.can_manage(
              request.user, semester=semester, pool=instance.pool,
          )
          message = MESSAGES["ADMINS_ONLY"]
  
      if not can_edit:
          messages.add_message(request, messages.ERROR, message)
          return HttpResponseRedirect(semester.get_view_url())
  
      page_name = "Edit " + instance.title
  
      edit_form = WorkshiftInstanceForm(
          data=request.POST if "edit" in request.POST else None,
          instance=instance,
          semester=semester,
          edit_hours=False,
      )
  
      if "delete" in request.POST:
          instance.delete()
          return HttpResponseRedirect(wurl(
              "workshift:manage",
              sem_url=semester.sem_url,
          ))
      elif edit_form.is_valid():
          instance = edit_form.save()
          return HttpResponseRedirect(instance.get_view_url())
  
      return render_to_response("edit_instance.html", {
          "page_name": page_name,
          "instance": instance,
          "edit_form": edit_form,
      }, context_instance=RequestContext(request))
docs: View for a manager to edit the details of a particular WorkshiftInstance.