我从查询对象得到这种类型的结果:
report_qs = CustomReport.objects.all().filter(id=report_id)
[<CustomReport: {'Name': 'Zara', 'Age': 7, 'Class': 'First'}>]
自定义报告模型:
class CustomReport(models.Model):
"""
Save the result of the custom report form wizard for further
regeneration. The result is saved as a serialized dictionary.
"""
class Meta:
unique_together = (('creation_date', 'name'),)
name = models.CharField(max_length=64)
query = models.TextField()
creation_date = models.DateTimeField(default=datetime.datetime.now,
editable=False)
def __unicode__(self):
return self.query
如何获取值和键?