docs: def modify_profile_request_view(request, request_pk):
      ''' The page to modify a user's profile request. request_pk is the pk of the profile request. '''
      page_name = "Admin - Profile Request"
      profile_request = get_object_or_404(ProfileRequest, pk=request_pk)
      mod_form = ModifyProfileRequestForm(
          request.POST if "add_user" in request.POST else None,
          instance=profile_request,
          )
      addendum = ""
      if 'delete_request' in request.POST:
          if settings.SEND_EMAILS and (profile_request.email not in settings.EMAIL_BLACKLIST):
              deletion_subject = DELETION_SUBJECT.format(house=settings.HOUSE_NAME)
              deletion_email = DELETION_EMAIL.format(house=settings.HOUSE_NAME, full_name=profile_request.first_name + " " + profile_request.last_name,
                  admin_name=settings.ADMINS[0][0], admin_email=settings.ADMINS[0][1])
              try:
                  send_mail(deletion_subject, deletion_email, settings.EMAIL_HOST_USER, [profile_request.email], fail_silently=False)
                  addendum = MESSAGES['PROFILE_REQUEST_DELETION_EMAIL'].format(full_name=profile_request.first_name + ' ' + profile_request.last_name,
                      email=profile_request.email)
              except SMTPException as e:
                  message = MESSAGES['EMAIL_FAIL'].format(email=profile_request.email, error=e)
                  messages.add_message(request, messages.ERROR, message)
          profile_request.delete()
          message = MESSAGES['PREQ_DEL'].format(first_name=profile_request.first_name, last_name=profile_request.last_name, username=profile_request.username)
          messages.add_message(request, messages.SUCCESS, message + addendum)
          return HttpResponseRedirect(reverse('manage_profile_requests'))
      if mod_form.is_valid():
          new_user = mod_form.save(profile_request)
          if new_user.is_active and settings.SEND_EMAILS and (new_user.email not in settings.EMAIL_BLACKLIST):
              approval_subject = APPROVAL_SUBJECT.format(house=settings.HOUSE_NAME)
              if profile_request.provider:
                  username_bit = profile_request.provider.title()
              elif new_user.username == profile_request.username:
                  username_bit = "the username and password you selected"
              else:
                  username_bit = "the username {0} and the password you selected".format(new_user.username)
              login_url = request.build_absolute_uri(reverse('login'))
              approval_email = APPROVAL_EMAIL.format(house=settings.HOUSE_NAME, full_name=new_user.get_full_name(), admin_name=settings.ADMINS[0][0],
                  admin_email=settings.ADMINS[0][1], login_url=login_url, username_bit=username_bit, request_date=profile_request.request_date)
              try:
                  send_mail(approval_subject, approval_email, settings.EMAIL_HOST_USER, [new_user.email], fail_silently=False)
                  addendum = MESSAGES['PROFILE_REQUEST_APPROVAL_EMAIL'].format(full_name="{0} {1}".format(new_user.first_name, new_user.last_name),
                      email=new_user.email)
              except SMTPException as e:
                  message = MESSAGES['EMAIL_FAIL'].format(email=new_user.email, error=e)
                  messages.add_message(request, messages.ERROR, message)
          message = MESSAGES['USER_ADDED'].format(username=new_user.username)
          messages.add_message(request, messages.SUCCESS, message + addendum)
          return HttpResponseRedirect(reverse('manage_profile_requests'))
      return render_to_response('modify_profile_request.html', {
          'page_name': page_name,
          'add_user_form': mod_form,
          'provider': profile_request.provider,
          'uid': profile_request.uid,
          'affiliation_message': profile_request.message,
          'members': User.objects.all().exclude(username=ANONYMOUS_USERNAME),
          }, context_instance=RequestContext(request))