Django : Filter query based on custom function

前端 未结 4 1163
没有蜡笔的小新
没有蜡笔的小新 2020-12-09 08:01

I\'ve got a function built into my Django model class and I want to use that function to filter my query results.

  class service:
       ......
       def i         


        
4条回答
  •  感情败类
    2020-12-09 08:11

    You may not be able to, instead you can post-process the queryset with a list comprehension or generator expression.

    For example:

    [x for x in Q if x.somecond()]
    

提交回复
热议问题