Created
November 23, 2020 12:28
-
-
Save DiegoMagg/86dc63a235a97f8dbfc6a1ba4ae75f3f to your computer and use it in GitHub Desktop.
Django Raw Query to Queryset
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from myapp.models import Mymodel | |
Mymodel.objects.filter(pk__in=[i.pk for i in Mymodel.objects.raw("SELECT * FROM mytable")]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment