Changes between Version 1 and Version 2 of Ticket #29429


Ignore:
Timestamp:
May 22, 2018, 8:30:16 AM (7 years ago)
Author:
creative3000
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #29429

    • Property Owner changed from nobody to creative3000
    • Property Status newassigned
  • Ticket #29429 – Description

    v1 v2  
    11When you filter by len like in documentation example:
    2 "Post.objects.filter(tags__len=1)"
     2{{{
     3#!python
     4  Post.objects.filter(tags__len=1)
     5}}}
     6
    37But if you try to annotate something an error pops up example:
    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}}}
     12It 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}}}
Back to Top