Skip to Content
Меню
Вам необхідно зареєструватися, щоб взаємодіяти зі спільнотою.
Це запитання позначене
2901 Переглядів

I want to apply the len(one2many_field) in Search method of ORM. Like this search(..,order = "len(one2many_field)",..) .I want to order the result by finding total number of their children. The one2many field is in the relation to the same table. Presently I am not able to use len() in order.

Example :

 id    name    parent_id
  1     A       - 
  2     B       1 
  3     C       1 
  4     D       - 
  5     E       4

Result :

A
D
Аватар
Відмінити
Related Posts Відповіді Переглядів Дія
2
вер. 23
7714
2
бер. 23
46787
2
груд. 23
57703
0
бер. 22
2384
3
черв. 20
10689