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 """
|
||||
SELECT * FROM app_table;
|
||||
=> 3 rows of data
|
||||
"""]]
|
||||
|
||||
<pre class="src src-sql">SELECT * FROM app_table;
|
||||
=> 3 rows of data</pre>
|
||||
|
||||
<pre class="src src-python"><span class="org-keyword">from</span> app.models <span class="org-keyword">import</span> Table
|
||||
[[!format py """
|
||||
from app.models import Table
|
||||
|
||||
Table.objects.count()
|
||||
=> 3
|
||||
=> 3
|
||||
|
||||
Table.objects.<span class="org-builtin">all</span>()
|
||||
=> []</pre>
|
||||
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:
|
||||
|
||||
<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
|
||||
|
||||
<span class="org-keyword">class</span> <span class="org-type">Table</span>(SuperTable):...</pre>
|
||||
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
|
||||
|
|
Loading…
Reference in a new issue