django : How to write alias in queryset

后端 未结 5 1875
甜味超标
甜味超标 2021-02-06 04:33

How can one write an alias for the column name in django query set. Would be useful for union-style combinations of two linked field to the same foreign model (for instance).

5条回答
  •  天命终不由人
    2021-02-06 04:56

    I'm presuming this isn't possible, so I've raised a ticket for the feature to be added, I think there is some merit to being able to do this. Please see the ticket for more information.

    https://code.djangoproject.com/ticket/16735

提交回复
热议问题