I can get pagination to work at `http://127.0.0.1:8000/` using the below code:

```
{% if is_paginated %}
<div class="pagination">
            <span class="page-links">
                {% if page_obj.has_previous %}
                    <a href="/?page={{ page_obj.previous_page_number }}">previous</a>
                {% endif %}
                <span class="page-current">
                    Page {{ page_obj.number }} of {{ page_obj.paginator.num_pages }}.
                </span>
                {% if page_obj.has_next %}
                    <a href="/?page={{ page_obj.next_page_number }}">next</a>
                {% endif %}
            </span>
</div>
{% endif %}

```

views.py

```
class IndexView(generic.ListView):
    template_name = 'films/index.html'
    paginate_by = 1
    def get_queryset(self):
        return Film.objects.all()'

```

I would like to paginate a bunch of comments at `http://127.0.0.1:8000/film id` but so far have not been able to do so. My hrefs are usually like `<a href="{% url 'films:add_comment' film_id=film.id %}">Leave a comment</a>` but I am not fussed how it is wrote as long as it works.

Similar to the above I have tried:

```
class DetailView(generic.DetailView):
    model = Film
    paginate_by = 10
    template_name = 'films/detail.html'

```

I think this link needs changing to include the film id `<a href="/?page={{ page_obj.next_page_number }}">next</a>` but it is not displaying the previous/next links at the moment on this page, like it is doing on `http://127.0.0.1:8000/`

UPDATE:

index.html (works)

```
{% if object_list %}

<table id="myTable">
    <tr>
        <th>Title</th>
        <th>Director</th>
        <th>Description</th>
        <th>Released</th>
    </tr>
    {% for film in object_list %}
    <tr>
        <td><a href="{% url 'films:detail' film.id %}">{{ film.title }}</a></td>
        <td>{{ film.director}}</td>
        <td>{{ film.description}}</td>
        <td>{{ film.pub_date}}</td>
    </tr>
    {% endfor %}
</table>

{% if is_paginated %}
<div class="pagination">
            <span class="page-links">
                {% if page_obj.has_previous %}
                    <a href="/?page={{ page_obj.previous_page_number }}">previous</a>
                {% endif %}
                <span class="page-current">
                    Page {{ page_obj.number }} of {{ page_obj.paginator.num_pages }}.
                </span>
                {% if page_obj.has_next %}
                    <a href="/?page={{ page_obj.next_page_number }}">next</a>
                {% endif %}
            </span>
</div>
{% endif %}

{% else %}
<p>No films are available.</p>
{% endif %}

```

detail.html (not working)

```
<table id="myTable">
    <tr>
        <th>Comment</th>
        <th>User</th>
        {% if user.is_authenticated %}
        <th>Update</th>
        <th>Delete</th>
        {% endif %}

       {% for comment in film.comment_set.all %}
    <tr>
        <td>{{ comment.body }}</td>
        <td>{{ comment.user }}</td>
    {% if request.user == comment.user %}
        <td><a href="{% url 'films:update_comment' film_id=film.id comment_id=comment.id %}">Update</a></td>
        <td><a href="{% url 'films:delete_comment' film_id=film.id comment_id=comment.id %}">Delete</a></td>
    {% endif %}
        {% endfor %}
    </tr>

</table>

{% if is_paginated %}
<div class="pagination">
            <span class="page-links">
                {% if page_obj.has_previous %}
                    <a href="?page=={{ page_obj.previous_page_number }}">previous</a>
                {% endif %}
                <span class="page-current">
                    Page {{ page_obj.number }} of {{ page_obj.paginator.num_pages }}.
                </span>
                {% if page_obj.has_next %}
                    <a href="?page={{ page_obj.next_page_number }}">next</a>
                {% endif %}
            </span>
</div>
{% endif %}

<h2>Comment</h2>
{% if user.is_authenticated %}
<a href="{% url 'films:add_comment' film_id=film.id %}">Leave a comment</a>
{% else %}
<p>Please log in or register to comment</p>
{% endif %}

```