models.py
class ReportType(models.Model):
report = models.ForeignKey(Report)
title = models.CharField('Incident Type', max_length=200)
def __unicode__(self):
return self.title
views.py
def where(request):
user=request.user
try:
report = Report.objects.get(user=user.id)
except:
report = None
reporttype = ReportType.objects.all()
. . .
. . .
return render(request, 'incident/where.html',
{
'newreport_menu': True,
'reporttype':reporttype
})
它以这种形式[<ReportType: Bike parking>, <ReportType: car parking>]
给我输出。如何显示像“自行车停放,停车场”这样的值。