diff --git a/posts/Silly_django_confusion.mdwn b/posts/Silly_django_confusion.mdwn index 39ad00b..60b87c7 100644 --- a/posts/Silly_django_confusion.mdwn +++ b/posts/Silly_django_confusion.mdwn @@ -8,29 +8,30 @@ page. So this is what I found: [[!format sql """ SELECT * FROM app_table; + => 3 rows of data """]] -
SELECT * FROM app_table; - => 3 rows of data- -
from app.models import Table +[[!format py """ +from app.models import Table Table.objects.count() - => 3 + => 3 -Table.objects.all() - => []+Table.objects.all() + => [] +"""]] This is weird. So I looked at the `django.db.connection.queries` property and I realized that it was doing a join since the model subclasses another: -
from django.db import models +[[!format py """ +from django.db import models -from app.models import SuperTable - -class Table(SuperTable):...+from app.models import SuperTable +class Table(SuperTable):... +"""]] Which, of course, means that in order to get the complete `Table` instance, the related `SuperTable` instance is also required, but in