Перейти к содержимому
Меню
Чтобы взаимодействовать с сообществом, необходимо зарегистрироваться.
Этот вопрос был отмечен
2 Ответы
863 Представления

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)


Аватар
Отменить
Лучший ответ

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. 

Аватар
Отменить
Автор Лучший ответ

Thanks!

It worked fine.

Аватар
Отменить
Related Posts Ответы Просмотры Активность
0
окт. 23
2168
5
мар. 22
14861
1
февр. 16
5764
0
мар. 15
3859
4
янв. 24
23174