I am new to Django and Python,

I have a table for clients, and one for trips. I can display the clients on the clients page, and the same for the trips.

But on the clients page, I want to show all the trips that are linked to each client. And this is where I hit a wall.

This is my **models.py**

```
from django.db import models
from django.core.validators import RegexValidator

# Create your models here.

class Clientes(models.Model):
    nome = models.CharField(max_length=30)
    apelido = models.CharField(max_length=30)
    morada = models.CharField(max_length=200)
    tel = models.CharField(max_length=9, validators=[RegexValidator(r'^\d{1,10}$')])
    nif = models.CharField(max_length=9, validators=[RegexValidator(r'^\d{1,10}$')])

    def __str__(self):
        return "%s %s" % (self.nome, self.apelido)

    class Meta:
        verbose_name_plural = "Clientes"

class Viagem(models.Model):
    trip_id = models.CharField(max_length=30)
    cliente = models.ForeignKey(Clientes, on_delete=models.CASCADE)
    comp = models.CharField(max_length=30)
    data = models.DateField()
    destino = models.CharField(max_length=30)

    def __str__(self):
        return self.trip_id

    class Meta:
        verbose_name_plural = "Viagens"

```

This is my **views.py**

```
from django.shortcuts import render
from django.http import HttpResponse
from .models import Clientes, Viagem

# Create your views here.

def index(request):
    ls= Clientes.objects.all()    
    context = {'ls': ls}
    return render(request, "booking/home.html", context)

def cliente(request, id):
    ls= Clientes.objects.filter(id=id)
    context = {'ls': ls}
    return render(request, "booking/cliente.html", context)

def trip(request):
    ls= Viagem.objects.all()    
    context = {'ls': ls}
    return render(request, "booking/trip.html", context)

```

and this is the table on the **home.html**

```
    <table id="selector" class="table is-fullwidth is-hoverable">
    <thead>
      <tr>
        <th>Nome</th>
        <th>Apelido</th>
        <th>Morada</th>
        <th>Telemóvel</th>
        <th>NIF</th>
        <th>Viagens</th>
      </tr>
    </thead>
    <tbody>
        {% for ls in ls %}
      <tr>
        <td>{{ls.nome}}</td>
        <td>{{ls.apelido}}</td>
        <td>{{ls.morada}}</td>
        <td>{{ls.tel}}</td>
        <td>{{ls.nif}}</td>
        <td>{{ls.trip_id}}</td>
      </tr>
      {% endfor %} 
    </tbody>
</table>

```

I assume it has something to do with ForeignKey, but a ForeignKey on the first class won't work.

I thought about creating a new `def` on the `views.py` using the `Viagem` table and a diferent context, but that also doesn't seem to be the solution.

So, anyone can point me in the right direction?