Get user's posts using class-based views

Creating a blog project, how do I get the current logged-in user’s posts using Class-based views?

What I have so far works, but it’s incomplete. I am able to get a specific user’s posts but if I try to get only the current logged-in user’s posts, this happens to my side navbar.

Here’s what I have so far

views.py

class UserIssueListView(ListView):
    model = Issue
    template_name = 'issues/user_issues.html'
    context_object_name = 'issues'
    paginate_by = 5

    def get_queryset(self):
        user = get_object_or_404(User, username=self.kwargs.get('username'))
        return Issue.objects.filter(author=user).order_by('-date_posted')
    

nav.html

 <div id="nav-menu">
    <ul class="nav-menu-items">
        <div id="navbar-toggle">
            <a href="#" class="menu-bars" id="hide-menu">
                <i class="fas fa-bars nav-icon"></i>
            </a>
            <a href="#"><h3 class="text-white">Bug Tracker</h3>
            </a>
        </div>
        <hr />
        <div class="nav-section">
            <li class="nav-text"><a href="{% url 'dashboard' %}"><i class="fas fa-home nav-icon"></i>Dashboard</a></li>
            <li class="nav-text"><a href="{% url 'issues-home' %}"><i class="fas fa-fire nav-icon"></i>Recent Issues</a></li>
            <li class="nav-text"><a href=""><i class="fab fa-youtube nav-icon"></i>My Projects</a></li>
        </div>
        <hr />
        <div class="nav-section">
            {% for issue in issues %}
            <li class="nav-text"><a href="{% url 'user-issues' issue.author.username %}"><i class="fas fa-play-circle nav-icon"></i>My Posts</a></li>
            {% endfor %}
            <li class="nav-text"><a href=""><i class="fas fa-history nav-icon"></i>User Profile</a></li>
            <!-- <li class="nav-text"><a href=""><i class="fas fa-clock nav-icon"></i>Subscriptions</a></li> -->
        </div>
    </ul>
  </div>

user_issues.html

{% for issue in issues %}
        <article class="media content-section">
          <img class="rounded-circle article-img" src="{{ issue.author.profile.image.url }}">
          <div class="media-body">
            <div class="article-metadata">
              <a class="mr-2" href="{% url 'user-issues' issue.author.username %}">{{ issue.author }}</a>
              <small class="text-muted">{{ issue.date_posted|date:"F d, Y" }}</small>
            </div>
            <h2><a class="article-title" href="{% url 'issue-detail' issue.id %}">{{ issue.title }}</a></h2>
            <p class="article-content">{{ issue.content }}</p>
          </div>
        </article>
{% endfor %}

I suspect it’s because the for loop is iterating through all existing user’s posts, but I’m stuck on how to proceed. How do I only get the current logged-in user’s posts?

The currently-authenticated user is attached to the request object in the view. You can write your query using that in your filter.