Highlight?
This commit is contained in:
parent
124cdee6ba
commit
7ee8c1a038
1 changed files with 12 additions and 11 deletions
|
@ -8,29 +8,30 @@ page. So this is what I found:
|
||||||
|
|
||||||
[[!format sql """
|
[[!format sql """
|
||||||
SELECT * FROM app_table;
|
SELECT * FROM app_table;
|
||||||
|
=> 3 rows of data
|
||||||
"""]]
|
"""]]
|
||||||
|
|
||||||
<pre class="src src-sql">SELECT * FROM app_table;
|
[[!format py """
|
||||||
=> 3 rows of data</pre>
|
from app.models import Table
|
||||||
|
|
||||||
<pre class="src src-python"><span class="org-keyword">from</span> app.models <span class="org-keyword">import</span> Table
|
|
||||||
|
|
||||||
Table.objects.count()
|
Table.objects.count()
|
||||||
=> 3
|
=> 3
|
||||||
|
|
||||||
Table.objects.<span class="org-builtin">all</span>()
|
Table.objects.all()
|
||||||
=> []</pre>
|
=> []
|
||||||
|
"""]]
|
||||||
|
|
||||||
This is weird. So I looked at the `django.db.connection.queries`
|
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
|
property and I realized that it was doing a join since the model
|
||||||
subclasses another:
|
subclasses another:
|
||||||
|
|
||||||
<pre class="src src-python"><span class="org-keyword">from</span> django.db <span class="org-keyword">import</span> models
|
[[!format py """
|
||||||
|
from django.db import models
|
||||||
|
|
||||||
<span class="org-keyword">from</span> app.models <span class="org-keyword">import</span> SuperTable
|
from app.models import SuperTable
|
||||||
|
|
||||||
<span class="org-keyword">class</span> <span class="org-type">Table</span>(SuperTable):...</pre>
|
|
||||||
|
|
||||||
|
class Table(SuperTable):...
|
||||||
|
"""]]
|
||||||
|
|
||||||
Which, of course, means that in order to get the complete `Table`
|
Which, of course, means that in order to get the complete `Table`
|
||||||
instance, the related `SuperTable` instance is also required, but in
|
instance, the related `SuperTable` instance is also required, but in
|
||||||
|
|
Loading…
Reference in a new issue