Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You'll need to use:</p> <pre><code>StellarObjectAdmin.list_display.insert(1, 'size') </code></pre> <p>Also, you'll need to change <code>list_display</code> from a <code>tuple</code> (which is <a href="http://en.wikipedia.org/wiki/Immutable_object" rel="nofollow">immutable</a>) to a <code>list</code>. Eg: <code>list_display = [ ... ]</code>.</p> <p>Finally, you'll probably be surprised by what happens: by inserting the item, you're going to be changing the list on <code>StellarObjectAdmin</code>. What you probably want to do is:</p> <pre><code>list_display = list(StellarObjectAdmin.list_display) # copy the list list_display.insert(1, 'size') </code></pre> <p>Which will create a new copy of the list for your <code>PlanetAdmin</code> class.</p> <p>This happens because of the way Python does inheritance. Basically, Python never injects names into a namespace (eg, some languages inject a magic <code>this</code> "variable" into methods, while Python forces you to explicitly define the equivalent — <code>self</code> — as the first argument of methods), and since a <code>class</code> is just another namespace, nothing (like, eg, values in its super classes) gets injected into it.</p> <p>When you've got a class, <code>B</code>, which inherits from another class, <code>A</code>, and you try to look up a property on <code>B</code> — <code>B.foo</code> — it first checks to see if <code>foo</code> is in <code>B</code>'s namespace, and if it isn't, it goes on to check <code>A</code>'s namespace, and so on.</p> <p>I hope that's clear… If not, I can clarify (or try to find relevant documentation).</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload