Django serializers只返回外键id

models.py

class Person(models.Model):
    name = models.CharField(max_length=128)
    num = models.IntegerField(blank=True,default=0)
    
class Expression(models.Model):
    text = models.CharField(max_length=280,blank=True)
    towhom = models.ForeignKey(Person,related_name="towhom")
    fromwhom = models.ForeignKey(Person,related_name="fromwhom")

views.py

def Update(req,id):
    response = HttpResponse()
    response['Content-Type'] = "text/javascript"
    response.write(serializers.serialize('json', Expression.objects.filter(pk__gt=id)))
    return HttpResponse(response)

返回结果

[{"fields": {"towhom": 2, "text": "312312",  "fromwhom": 4}, "model": "items.expression", "pk": 32}]

我想返回对用Person模型的名字,这要怎么弄?

查看回复