class Picture(models.Model):
title = models.CharField(max_length=255)
class PictureRate(models.Model):
user = models.ForeignKey(User)
picture = models.ForeignKey(Picture)
rate = models.DecimalField(max_digits=2,decimal_places=1)
ビュー:
def index(request):
pictures = Picture.objects.all()
return render_to_response('index.html',{'pictures':pictures}, context_instance=RequestContext(request))
テンプレート内:
{% for p in pictures %}
{{ p.title }}
{% endfor %}
rate
すべての評価()のテンプレートカウントで表示する方法はPicture
?