I have 2 models defined as follows:
class Article(models.Model): url = models.URLField(max_length=200, unique=True, null=False) title = models.CharField(max_length=200, unique=False, null=False) class List(models.Model): article = models.ForeignKey(Article, related_name='joining') list = models.IntegerField(default=0, null=False, unique=False) Querying the Article
class InboxView(SomeMixin, generic.ListView): template_name = '...' context_object_name = 'article_list' def get_queryset(self): return Article.objects.all().prefetch_related('joining') On my template, this works:
{% for article in article_list %} {{ article.title }} {% endfor %} But this does not
{% for article in article_list %} {{ article.list }} {% endfor %}