Skip to content

Instantly share code, notes, and snippets.

@Ingco
Created February 18, 2020 12:13
Show Gist options
  • Save Ingco/5c3cb9ec941a70e852172ffea297e172 to your computer and use it in GitHub Desktop.
Save Ingco/5c3cb9ec941a70e852172ffea297e172 to your computer and use it in GitHub Desktop.
order = (
Order.objects
.select_related("patient", "client")
.prefetch_related(
"orderstep_order__orderstepmisc_orderstep__misc",
"orderstep_order__orderstepjob_orderstep"
)
.annotate(orderstep_order__row_number=number_subquery)
.filter(pk=pk)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment