开发者

How can i add key/value to object queryset

开发者 https://www.devze.com 2022-12-14 23:27 出处:网络
I need to add key/val开发者_如何转开发ue to queryset per each object based on stuff in request.session.

I need to add key/val开发者_如何转开发ue to queryset per each object based on stuff in request.session.

How to do that?

Alan


Historical answer:

You can use the .extra() method on a queryset to add extra 'fields'.

There is some documentation that may be useful.

New answer:

You should use the .annotate() method to add extra fields.

View the documentation.

0

精彩评论

暂无评论...
验证码 换一张
取 消