Hi,
The problem with your approach is the SQL will actually be something like this:
select <model fields>,
(select id from web_quote WHERE character_length(quote_text) < 30) as val
from <model table>;
That will fail in RDMS like Postgres if there are more than one "quote_text" with length < 30.
May be you want is something like this:
select <model fields>
from <model table>
where character_length(quote_text) < 30
If that is the case, then you probably will need something like:
return queryset.extra(where=['character_length(quote_text) < 30'])
or even better:
from django.db.models.functions import Length
return quryset.annotate(quote_len=Length('quote_text')).filter(quote_len__lt=30)
Notice extra() is deprecated.