クエリセットは次のとおりです。
researches = Graph.objects.filter(subject=subject_object).exclude(type='infografik').values_list('name', flat=True).distinct()
私がする時:
{% for research in researches %}
私のテンプレートでは、その間のコードは適切な回数実行されますが、たとえば{{ research.name }}
機能しません。
オブジェクトの属性にアクセスするにはどうすればよいですか?
ありがとう。
編集:
グラフモデル
name = models.CharField(max_length=100)
research = models.ForeignKey('Research')
explanation = models.TextField(max_length=1000)
path_to_file = models.CharField(max_length=100)
type = models.CharField(max_length=30, choices=type, null=True, blank=True)
subject = models.ManyToManyField(Subject)
thumbnail = models.ImageField(upload_to='thumbnails/', null=True, blank=True)
slug = models.SlugField(max_length=120, unique=True)