Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
2915 Lượt xem

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
Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
2
thg 9 23
7716
2
thg 3 23
46798
2
thg 12 23
57709
0
thg 3 22
2389
3
thg 6 20
10696