Django - Include data from foreignkey in admin list_display function

前端 未结 3 1070
野的像风
野的像风 2021-01-20 03:48

I have two models and one admin model:

class Person(models.Model):

    firstname = models.CharField(maxlength=50)
    surname = models.CharField(maxlength=5         


        
3条回答
  •  野的像风
    2021-01-20 04:01

    Thans for your Answer uvasal (it was very helpful) but this code has invalid syntax

    you need: return '%s'%(obj.book.review,) or return '%s' % obj.book.review

提交回复
热议问题