I am trying to display a brand of a bike, but the value shows as None.
Models.py:
class Bike(models.Model):
item = models.OneToOneField(Item, on_delete=models.CASCADE)
brand = models.ManyToManyField(Brand, null=True)
class Brand(models.Model):
name = models.CharField(max_length=20)
and here's my template:
{% for item in items %}
{{ item.bike.brand.name }} {{ item.title }}
{% endfor %}
I am calling the brand by {{ item.bike.brand.name }}
and it displays as None for every Bike