Skip to Content
Menú
This question has been flagged
2 Respostes
667 Vistes

Hi, 

I am trying to display the book's author name in a list view. I added <field name="author.name" /> inside the <list> tag, but I get this error:
Field "author.name" does not exist in model "book"


How can I fix this?

Models:

  author

​- name


  book 

​- author


I fixed this creating a compute field called author_name and resolve it in model file. I did this, but I would like to know wheather there is someway more simple (like Django)


Avatar
Descartar
Best Answer

Creating a related field in the book model with stored=True, or a calculated field the way you're doing is good. Because sometimes you need to search and filter by the author. And there maybe more than 1 author for a book. Normally for display purpose, I think sometimes we just add the author to the list view (and the name will automatically be shown with a link to that author. 

Avatar
Descartar
Autor Best Answer

Thanks!

It worked fine.

Avatar
Descartar
Related Posts Respostes Vistes Activitat
0
d’oct. 23
1987
5
de març 22
14550
1
de febr. 16
5635
0
de març 15
3685
4
de gen. 24
22910