From 7ee8c1a03806139bffe475475927010440b57c5d Mon Sep 17 00:00:00 2001 From: Tom Willemsen Date: Sun, 4 Nov 2012 19:13:22 +0100 Subject: [PATCH] Highlight? --- posts/Silly_django_confusion.mdwn | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) 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