| 4 | | "Post.objects.all().annotate(tag_len=F('tags__len'))" |
| 5 | | It really seems that it should work by default, but instead I needed to use something like this |
| 6 | | "Post.objects.all().annotate(tag_len=Func(F('tags'), 1, function='array_length'))" |
| | 8 | {{{ |
| | 9 | #!python |
| | 10 | Post.objects.all().annotate(tag_len=F('tags__len')) |
| | 11 | }}} |
| | 12 | It really seems that it should work by default, but instead I needed to use something like this |
| | 13 | {{{ |
| | 14 | #!python |
| | 15 | Post.objects.all().annotate(tag_len=Func(F('tags'), 1, function='array_length')) |
| | 16 | }}} |