def instance_view(request, semester, pk, profile=None):
    """
    View the details of a particular WorkshiftInstance.
    """
    instance = get_object_or_404(WorkshiftInstance, pk=pk)
    page_name = instance.title
    management = utils.can_manage(
        request.user,
        semester=semester,
        pool=instance.pool,
    )
    interact_forms = _get_forms(
        profile, instance, request,
        undo=management,
        prefix="interact",
    )

    note_form = NoteForm(
        data=request.POST or None,
        prefix="note",
    )

    # Save any forms that were submitted
    if note_form.is_valid():
        for form in interact_forms:
            if form.is_valid():
                note = note_form.save()
                form.save(note=note)
                return HttpResponseRedirect(instance.get_view_url())
            else:
                for error in form.errors.values():
                    messages.add_message(request, messages.ERROR, error)

    edit_hours_form = None
    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
    else:
        can_edit = utils.can_manage(
            request.user, semester=instance.pool.semester, pool=instance.pool,
        )

    if can_edit:
        edit_hours_form = EditHoursForm(
            data=request.POST if "edit_hours" in request.POST else None,
            instance=instance,
            profile=profile,
        )
        if edit_hours_form.is_valid():
            edit_hours_form.save()
            messages.add_message(
                request,
                messages.INFO,
                "Updated instance's hours.",
            )
            return HttpResponseRedirect(instance.get_view_url())

    return render_to_response("view_instance.html", {
        "page_name": page_name,
        "can_edit": can_edit,
        "instance": instance,
        "interact_forms": interact_forms,
        "note_form": note_form,
        "edit_hours_form": edit_hours_form,
    }, context_instance=RequestContext(request))
View the details of a particular WorkshiftInstance.