Views
class ThreadListView(ListView):
model = Thread
template_name = 'forums/thread.html'
def get_context_data(self, **kwargs):
# Call the base implementation first to get a context
context = super().get_context_data(**kwargs)
# Add in a QuerySet of the Thread & Replies
context['thread'] = Thread.objects.get(pk=self.kwargs['pk'])
context['reply'] = Thread.objects.get(pk=self.kwargs['pk']).replies.all()
return context
HTML
{% extends 'forums/base.html' %}
{% block title %} Forum - {{ thread.title }} {% endblock title %}
{% block content %}
<!--Thread real-->
<table class="table table-hover">
<thead>
<tr class="table-primary">
<th class="col-2"><a href="{% url 'threadview' thread.id %}"> {{ thread.title }}</a></th>
<th scope="col-10" id="content-col"></th>
</tr>
</thead>
<tbody>
<!--Thread Author and Content-->
<tr class="table-info">
<td class="border-right text-center">
<span>
<img class="rounded-circle" style="height: 100px;width: 100px;"
src="{{ thread.author.profile.image.url }}"> <br />
Username: <a href="#">{{ thread.author.username|capfirst }}</a> <br />
Ranks: 
<!--Ranks Go Here--> <br />
<hr>
Posts: 
<!--Posts Go Here--> <br />
Badges: 
<!--Badges Go Here--> <br />
<hr>
Date Joined: {{thread.author.date_joined| date:'Y-m-d'}} <br />
</span>
</td>
<td>{{ thread.content }}</td>
</tr>
<!--Reply Author and Content-->
{% for rply in reply %}
<tr class="table-secondary">
<td class="border-right text-center">
<span>
<img class="rounded-circle" style="height: 100px;width: 100px;"
src="{{ rply.author.profile.image.url }}"> <br />
Username: <a href="#">{{ rply.author.username|capfirst }}</a> <br />
Ranks: 
<!--Ranks Go Here--> <br />
<hr>
Posts: 
<!--Posts Go Here--> <br />
Badges: 
<!--Badges Go Here--> <br />
<hr>
Date Joined: {{thread.author.date_joined| date:'Y-m-d'}} <br />
</span>
</td>
<td>
<p>{{ rply.content }}</p>
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% endblock content %}
I want to Paginate the Thread ListView.
The Thread ListView shows the Thread and then it shows the replies that are on that thread.
I want to be able to split up all the content into pages.
An example is that the thread starts with the Thread post and 10 replies and then to view some of the newer replies you will be able to click on the next page.