[Fixed]-How to check the raw sql statement of getting the foreign key set of a model instance?

1👍

You need to get the queryset of the RelatedManager and then get the query of that queryset

u1.post_set.get_queryset().query

This should turn into something like

'SELECT (some fields) FROM "the _set model" WHERE "_set_model"."model.id" = 1'
👤Sayse

Leave a comment