code: def profile_detail(
      request, username,
      template_name=accounts_settings.ACCOUNTS_PROFILE_DETAIL_TEMPLATE,
      extra_context=None, **kwargs):
      
      user = get_object_or_404(get_user_model(),
                               username__iexact=username)
      profile_model = get_profile_model()
      try:
          profile = user.get_profile()
      except profile_model.DoesNotExist:
          profile = profile_model(user=user)
          profile.save()
      if not profile.can_view_profile(request.user):
          return HttpResponseForbidden(_("You don't have permission to view this profile."))
      if not extra_context:
          extra_context = dict()
      extra_context['profile'] = user.get_profile()
      return ExtraContextTemplateView.as_view(template_name=template_name,
                                         extra_context=extra_context)(request)
docs: Detailed view of an user.
  
      :param username:
          String of the username of which the profile should be viewed.
  
      :param template_name:
          String representing the template name that should be used to display
          the profile.
  
      :param extra_context:
          Dictionary of variables which should be supplied to the template. The
          ``profile`` key is always the current profile.
  
      **Context**
  
      ``profile``
          Instance of the currently viewed ``Profile``.