Questions tagged [django-inheritance]

78 questions
122
votes
10 answers

In Django - Model Inheritance - Does it allow you to override a parent model's attribute?

I'm looking to do this: class Place(models.Model): name = models.CharField(max_length=20) rating = models.DecimalField() class LongNamedRestaurant(Place): # Subclassing `Place`. name = models.CharField(max_length=255) # Notice, I'm…
Johnny 5
  • 1,521
  • 3
  • 10
  • 11
37
votes
3 answers

Django templates: overriding blocks of included children templates through an extended template

I'm wondering if anyone knows how to deal with the following quirky template structure: ### base.html {% block title %} Title of the page {% endblock %}…</div> <div class="grid ai-start jc-space-between fw-wrap"> <div class="grid gs4 fw-wrap tags "> <a href="../../questions/tagged/python" class="post-tag grid--cell" title="show questions tagged 'python'" rel="tag">python</a> <a href="../../questions/tagged/django" class="post-tag grid--cell" title="show questions tagged 'django'" rel="tag">django</a> <a href="../../questions/tagged/django-templates" class="post-tag grid--cell" title="show questions tagged 'django-templates'" rel="tag">django-templates</a> <a href="../../questions/tagged/django-inheritance" class="post-tag grid--cell" title="show questions tagged 'django-inheritance'" rel="tag">django-inheritance</a> </div> <div class="started mt0"> <div class="s-user-card s-user-card"> <time class="s-user-card--time" datetime="asked Apr 03 '12 at 15:23">asked Apr 03 '12 at 15:23</time> <a href="../../users/1293695/chris-keele" class="s-avatar s-avatar__32 s-user-card--avatar"> <img class="s-avatar--image" src="../../users/profiles/1293695.webp" data-jdenticon-width="32" data-jdenticon-height="32" data-jdenticon-value="Chris Keele" /> </a> <div class="s-user-card--info"> <a href="../../users/1293695/chris-keele" class="s-user-card--link">Chris Keele</a> <ul class="s-user-card--awards"> <li class="s-user-card--rep" title="reputation score">3,364</li> <li class="s-award-bling s-award-bling__gold" title="3 gold badges">3</li> <li class="s-award-bling s-award-bling__silver" title="30 silver badges">30</li> <li class="s-award-bling s-award-bling__bronze" title="52 bronze badges">52</li> </ul> </div> </div> </div> </div> </div> </div> </div> <div class="mln24"> <div class="question-summary" id="question-summary-5225556"> <div class="statscontainer"> <div class="stats"> <div class="vote"> <div class="votes"> <span class="vote-count-post"><strong>11</strong></span> <div class="viewcount">votes</div> </div> </div> <div class="status answered-accepted"> <strong>4</strong> answers </div> </div> </div> <div class="summary"> <h3><a href="../../questions/5225556/determining-django-model-instance-types-after-a-query-on-a-base-class" class="question-hyperlink">Determining Django Model Instance Types after a Query on a Base-class</a></h3> <div class="excerpt">Is there a way to determine what the 'real' class of a Django database object is, after it has been returned from a query for on a base class? For instance, if I have these models... class Animal(models.Model): name=…</div> <div class="grid ai-start jc-space-between fw-wrap"> <div class="grid gs4 fw-wrap tags "> <a href="../../questions/tagged/django" class="post-tag grid--cell" title="show questions tagged 'django'" rel="tag">django</a> <a href="../../questions/tagged/inheritance" class="post-tag grid--cell" title="show questions tagged 'inheritance'" rel="tag">inheritance</a> <a href="../../questions/tagged/django-models" class="post-tag grid--cell" title="show questions tagged 'django-models'" rel="tag">django-models</a> <a href="../../questions/tagged/django-inheritance" class="post-tag grid--cell" title="show questions tagged 'django-inheritance'" rel="tag">django-inheritance</a> </div> <div class="started mt0"> <div class="s-user-card s-user-card"> <time class="s-user-card--time" datetime="asked Mar 07 '11 at 21:36">asked Mar 07 '11 at 21:36</time> <a href="../../users/273637/chris-w" class="s-avatar s-avatar__32 s-user-card--avatar"> <img class="s-avatar--image" src="../../users/profiles/273637.webp" data-jdenticon-width="32" data-jdenticon-height="32" data-jdenticon-value="Chris W." /> </a> <div class="s-user-card--info"> <a href="../../users/273637/chris-w" class="s-user-card--link">Chris W.</a> <ul class="s-user-card--awards"> <li class="s-user-card--rep" title="reputation score">37,583</li> <li class="s-award-bling s-award-bling__gold" title="36 gold badges">36</li> <li class="s-award-bling s-award-bling__silver" title="99 silver badges">99</li> <li class="s-award-bling s-award-bling__bronze" title="136 bronze badges">136</li> </ul> </div> </div> </div> </div> </div> </div> </div> <div class="mln24"> <div class="question-summary" id="question-summary-50525301"> <div class="statscontainer"> <div class="stats"> <div class="vote"> <div class="votes"> <span class="vote-count-post"><strong>7</strong></span> <div class="viewcount">votes</div> </div> </div> <div class="status "> <strong>3</strong> answers </div> </div> </div> <div class="summary"> <h3><a href="../../questions/50525301/django-inheritance-and-polymorphism-with-proxy-models" class="question-hyperlink">Django inheritance and polymorphism with proxy models</a></h3> <div class="excerpt">I'm working on a Django project that I did not start and I am facing a problem of inheritance. I have a big model (simplified in the example) called MyModel that is supposed to represents different kind of items. All the instance objects of MyModel…</div> <div class="grid ai-start jc-space-between fw-wrap"> <div class="grid gs4 fw-wrap tags "> <a href="../../questions/tagged/python" class="post-tag grid--cell" title="show questions tagged 'python'" rel="tag">python</a> <a href="../../questions/tagged/django" class="post-tag grid--cell" title="show questions tagged 'django'" rel="tag">django</a> <a href="../../questions/tagged/django-models" class="post-tag grid--cell" title="show questions tagged 'django-models'" rel="tag">django-models</a> <a href="../../questions/tagged/proxy-classes" class="post-tag grid--cell" title="show questions tagged 'proxy-classes'" rel="tag">proxy-classes</a> <a href="../../questions/tagged/django-inheritance" class="post-tag grid--cell" title="show questions tagged 'django-inheritance'" rel="tag">django-inheritance</a> </div> <div class="started mt0"> <div class="s-user-card s-user-card"> <time class="s-user-card--time" datetime="asked May 25 '18 at 08:58">asked May 25 '18 at 08:58</time> <a href="../../users/1191416/leonardo" class="s-avatar s-avatar__32 s-user-card--avatar"> <img class="s-avatar--image" src="../../users/profiles/1191416.webp" data-jdenticon-width="32" data-jdenticon-height="32" data-jdenticon-value="Leonardo" /> </a> <div class="s-user-card--info"> <a href="../../users/1191416/leonardo" class="s-user-card--link">Leonardo</a> <ul class="s-user-card--awards"> <li class="s-user-card--rep" title="reputation score">4,046</li> <li class="s-award-bling s-award-bling__gold" title="5 gold badges">5</li> <li class="s-award-bling s-award-bling__silver" title="44 silver badges">44</li> <li class="s-award-bling s-award-bling__bronze" title="85 bronze badges">85</li> </ul> </div> </div> </div> </div> </div> </div> </div> <div class="mln24"> <div class="question-summary" id="question-summary-5317670"> <div class="statscontainer"> <div class="stats"> <div class="vote"> <div class="votes"> <span class="vote-count-post"><strong>6</strong></span> <div class="viewcount">votes</div> </div> </div> <div class="status answered-accepted"> <strong>1</strong> answer </div> </div> </div> <div class="summary"> <h3><a href="../../questions/5317670/seperate-admin-interfaces-for-different-user-types-in-django" class="question-hyperlink">seperate 'admin' interfaces for different user types in django</a></h3> <div class="excerpt">I have recently being trying to create a project which has several levels of user involved. (Just an example of an abbreviated and rough schema) ME (Super User) Client(s) Customer(s) Survey…</div> <div class="grid ai-start jc-space-between fw-wrap"> <div class="grid gs4 fw-wrap tags "> <a href="../../questions/tagged/django" class="post-tag grid--cell" title="show questions tagged 'django'" rel="tag">django</a> <a href="../../questions/tagged/django-models" class="post-tag grid--cell" title="show questions tagged 'django-models'" rel="tag">django-models</a> <a href="../../questions/tagged/django-admin" class="post-tag grid--cell" title="show questions tagged 'django-admin'" rel="tag">django-admin</a> <a href="../../questions/tagged/django-users" class="post-tag grid--cell" title="show questions tagged 'django-users'" rel="tag">django-users</a> <a href="../../questions/tagged/django-inheritance" class="post-tag grid--cell" title="show questions tagged 'django-inheritance'" rel="tag">django-inheritance</a> </div> <div class="started mt0"> <div class="s-user-card s-user-card"> <time class="s-user-card--time" datetime="asked Mar 15 '11 at 20:30">asked Mar 15 '11 at 20:30</time> <a href="../../users/647107/pete-hamilton" class="s-avatar s-avatar__32 s-user-card--avatar"> <img class="s-avatar--image" src="../../users/profiles/647107.webp" data-jdenticon-width="32" data-jdenticon-height="32" data-jdenticon-value="Pete Hamilton" /> </a> <div class="s-user-card--info"> <a href="../../users/647107/pete-hamilton" class="s-user-card--link">Pete Hamilton</a> <ul class="s-user-card--awards"> <li class="s-user-card--rep" title="reputation score">7,730</li> <li class="s-award-bling s-award-bling__gold" title="6 gold badges">6</li> <li class="s-award-bling s-award-bling__silver" title="33 silver badges">33</li> <li class="s-award-bling s-award-bling__bronze" title="58 bronze badges">58</li> </ul> </div> </div> </div> </div> </div> </div> </div> <div class="mln24"> <div class="question-summary" id="question-summary-6887779"> <div class="statscontainer"> <div class="stats"> <div class="vote"> <div class="votes"> <span class="vote-count-post"><strong>5</strong></span> <div class="viewcount">votes</div> </div> </div> <div class="status "> <strong>2</strong> answers </div> </div> </div> <div class="summary"> <h3><a href="../../questions/6887779/django-select-related-with-fields-specified-breaks-over-multiple-one-to-one-re" class="question-hyperlink">Django select_related with fields specified breaks over multiple one to one relationships</a></h3> <div class="excerpt">I'm getting a weird error trying to select_related over multiple OneToOneField relationships, e.g. in the case where the target field is a grandchild subclass. I'd love someone to help me understand what's going on (or confirm that this is a bug in…</div> <div class="grid ai-start jc-space-between fw-wrap"> <div class="grid gs4 fw-wrap tags "> <a href="../../questions/tagged/django" class="post-tag grid--cell" title="show questions tagged 'django'" rel="tag">django</a> <a href="../../questions/tagged/django-queryset" class="post-tag grid--cell" title="show questions tagged 'django-queryset'" rel="tag">django-queryset</a> <a href="../../questions/tagged/django-orm" class="post-tag grid--cell" title="show questions tagged 'django-orm'" rel="tag">django-orm</a> <a href="../../questions/tagged/django-select-related" class="post-tag grid--cell" title="show questions tagged 'django-select-related'" rel="tag">django-select-related</a> <a href="../../questions/tagged/django-inheritance" class="post-tag grid--cell" title="show questions tagged 'django-inheritance'" rel="tag">django-inheritance</a> </div> <div class="started mt0"> <div class="s-user-card s-user-card"> <time class="s-user-card--time" datetime="asked Jul 31 '11 at 05:45">asked Jul 31 '11 at 05:45</time> <a href="../../users/381787/rfrankel" class="s-avatar s-avatar__32 s-user-card--avatar"> <img class="s-avatar--image" src="../../users/profiles/381787.webp" data-jdenticon-width="32" data-jdenticon-height="32" data-jdenticon-value="rfrankel" /> </a> <div class="s-user-card--info"> <a href="../../users/381787/rfrankel" class="s-user-card--link">rfrankel</a> <ul class="s-user-card--awards"> <li class="s-user-card--rep" title="reputation score">675</li> <li class="s-award-bling s-award-bling__silver" title="8 silver badges">8</li> <li class="s-award-bling s-award-bling__bronze" title="20 bronze badges">20</li> </ul> </div> </div> </div> </div> </div> </div> </div> <div class="mln24"> <div class="question-summary" id="question-summary-45494664"> <div class="statscontainer"> <div class="stats"> <div class="vote"> <div class="votes"> <span class="vote-count-post"><strong>5</strong></span> <div class="viewcount">votes</div> </div> </div> <div class="status answered-accepted"> <strong>2</strong> answers </div> </div> </div> <div class="summary"> <h3><a href="../../questions/45494664/how-to-associate-existing-parent-with-child-in-django-multitable-inheritance" class="question-hyperlink">how to associate existing parent with child in django multitable inheritance</a></h3> <div class="excerpt">I have an existing parent entity with many existing records: class Entity(models.Model): name = models.CharField('Name', max_length=64, db_index=True) I also have child objects that extend using django multi table inheritance: class…</div> <div class="grid ai-start jc-space-between fw-wrap"> <div class="grid gs4 fw-wrap tags "> <a href="../../questions/tagged/django" class="post-tag grid--cell" title="show questions tagged 'django'" rel="tag">django</a> <a href="../../questions/tagged/django-inheritance" class="post-tag grid--cell" title="show questions tagged 'django-inheritance'" rel="tag">django-inheritance</a> </div> <div class="started mt0"> <div class="s-user-card s-user-card"> <time class="s-user-card--time" datetime="asked Aug 03 '17 at 21:17">asked Aug 03 '17 at 21:17</time> <a href="../../users/84885/atma" class="s-avatar s-avatar__32 s-user-card--avatar"> <img class="s-avatar--image" src="../../users/profiles/84885.webp" data-jdenticon-width="32" data-jdenticon-height="32" data-jdenticon-value="Atma" /> </a> <div class="s-user-card--info"> <a href="../../users/84885/atma" class="s-user-card--link">Atma</a> <ul class="s-user-card--awards"> <li class="s-user-card--rep" title="reputation score">29,141</li> <li class="s-award-bling s-award-bling__gold" title="56 gold badges">56</li> <li class="s-award-bling s-award-bling__silver" title="198 silver badges">198</li> <li class="s-award-bling s-award-bling__bronze" title="299 bronze badges">299</li> </ul> </div> </div> </div> </div> </div> </div> </div> <div class="mln24"> <div class="question-summary" id="question-summary-20304520"> <div class="statscontainer"> <div class="stats"> <div class="vote"> <div class="votes"> <span class="vote-count-post"><strong>5</strong></span> <div class="viewcount">votes</div> </div> </div> <div class="status answered-accepted"> <strong>3</strong> answers </div> </div> </div> <div class="summary"> <h3><a href="../../questions/20304520/id-of-object-is-none-after-save-in-django" class="question-hyperlink">id of object is none after save in django</a></h3> <div class="excerpt">I'm looping through a list of objects and saving. I need the newly generated id or pointer id right after the save but it is None. Here is my code: for category in category_list: saved_category = category.save() print…</div> <div class="grid ai-start jc-space-between fw-wrap"> <div class="grid gs4 fw-wrap tags "> <a href="../../questions/tagged/django" class="post-tag grid--cell" title="show questions tagged 'django'" rel="tag">django</a> <a href="../../questions/tagged/django-models" class="post-tag grid--cell" title="show questions tagged 'django-models'" rel="tag">django-models</a> <a href="../../questions/tagged/django-orm" class="post-tag grid--cell" title="show questions tagged 'django-orm'" rel="tag">django-orm</a> <a href="../../questions/tagged/django-inheritance" class="post-tag grid--cell" title="show questions tagged 'django-inheritance'" rel="tag">django-inheritance</a> <a href="../../questions/tagged/multi-table-inheritance" class="post-tag grid--cell" title="show questions tagged 'multi-table-inheritance'" rel="tag">multi-table-inheritance</a> </div> <div class="started mt0"> <div class="s-user-card s-user-card"> <time class="s-user-card--time" datetime="asked Nov 30 '13 at 19:16">asked Nov 30 '13 at 19:16</time> <a href="../../users/84885/atma" class="s-avatar s-avatar__32 s-user-card--avatar"> <img class="s-avatar--image" src="../../users/profiles/84885.webp" data-jdenticon-width="32" data-jdenticon-height="32" data-jdenticon-value="Atma" /> </a> <div class="s-user-card--info"> <a href="../../users/84885/atma" class="s-user-card--link">Atma</a> <ul class="s-user-card--awards"> <li class="s-user-card--rep" title="reputation score">29,141</li> <li class="s-award-bling s-award-bling__gold" title="56 gold badges">56</li> <li class="s-award-bling s-award-bling__silver" title="198 silver badges">198</li> <li class="s-award-bling s-award-bling__bronze" title="299 bronze badges">299</li> </ul> </div> </div> </div> </div> </div> </div> </div> <div class="mln24"> <div class="question-summary" id="question-summary-15736399"> <div class="statscontainer"> <div class="stats"> <div class="vote"> <div class="votes"> <span class="vote-count-post"><strong>5</strong></span> <div class="viewcount">votes</div> </div> </div> <div class="status "> <strong>4</strong> answers </div> </div> </div> <div class="summary"> <h3><a href="../../questions/15736399/django-renders-a-blank-page" class="question-hyperlink">django renders a blank page</a></h3> <div class="excerpt">Firstly, I'd like to admit, I'm a completely new to Django. I'm learning as best as I can. I am working my way through a book called "Beginning Django E-Commerce". Without wishing to breach the copy right, perhaps you guys can spot where I have gone…</div> <div class="grid ai-start jc-space-between fw-wrap"> <div class="grid gs4 fw-wrap tags "> <a href="../../questions/tagged/django" class="post-tag grid--cell" title="show questions tagged 'django'" rel="tag">django</a> <a href="../../questions/tagged/django-templates" class="post-tag grid--cell" title="show questions tagged 'django-templates'" rel="tag">django-templates</a> <a href="../../questions/tagged/django-views" class="post-tag grid--cell" title="show questions tagged 'django-views'" rel="tag">django-views</a> <a href="../../questions/tagged/django-inheritance" class="post-tag grid--cell" title="show questions tagged 'django-inheritance'" rel="tag">django-inheritance</a> </div> <div class="started mt0"> <div class="s-user-card s-user-card"> <time class="s-user-card--time" datetime="asked Apr 01 '13 at 01:13">asked Apr 01 '13 at 01:13</time> <a href="../../users/2230453/leeo" class="s-avatar s-avatar__32 s-user-card--avatar"> <img class="s-avatar--image" src="../../users/profiles/2230453.webp" data-jdenticon-width="32" data-jdenticon-height="32" data-jdenticon-value="LeeO" /> </a> <div class="s-user-card--info"> <a href="../../users/2230453/leeo" class="s-user-card--link">LeeO</a> <ul class="s-user-card--awards"> <li class="s-user-card--rep" title="reputation score">71</li> <li class="s-award-bling s-award-bling__silver" title="3 silver badges">3</li> <li class="s-award-bling s-award-bling__bronze" title="9 bronze badges">9</li> </ul> </div> </div> </div> </div> </div> </div> </div> <div class="mln24"> <div class="question-summary" id="question-summary-6303548"> <div class="statscontainer"> <div class="stats"> <div class="vote"> <div class="votes"> <span class="vote-count-post"><strong>4</strong></span> <div class="viewcount">votes</div> </div> </div> <div class="status answered-accepted"> <strong>2</strong> answers </div> </div> </div> <div class="summary"> <h3><a href="../../questions/6303548/is-it-possible-to-make-multi-level-template-inheritance-in-django-templates" class="question-hyperlink">Is it possible to make multi-level template inheritance in django templates?</a></h3> <div class="excerpt">I have three html-files: base.html page.html comment.html in page.html I extend base.html. In comment.html I extend page.html. Will comment.html extend base.html's blocks? </div> <div class="grid ai-start jc-space-between fw-wrap"> <div class="grid gs4 fw-wrap tags "> <a href="../../questions/tagged/django" class="post-tag grid--cell" title="show questions tagged 'django'" rel="tag">django</a> <a href="../../questions/tagged/inheritance" class="post-tag grid--cell" title="show questions tagged 'inheritance'" rel="tag">inheritance</a> <a href="../../questions/tagged/django-templates" class="post-tag grid--cell" title="show questions tagged 'django-templates'" rel="tag">django-templates</a> <a href="../../questions/tagged/django-inheritance" class="post-tag grid--cell" title="show questions tagged 'django-inheritance'" rel="tag">django-inheritance</a> <a href="../../questions/tagged/template-inheritance" class="post-tag grid--cell" title="show questions tagged 'template-inheritance'" rel="tag">template-inheritance</a> </div> <div class="started mt0"> <div class="s-user-card s-user-card"> <time class="s-user-card--time" datetime="asked Jun 10 '11 at 07:57">asked Jun 10 '11 at 07:57</time> <a href="../../users/378767/megido" class="s-avatar s-avatar__32 s-user-card--avatar"> <img class="s-avatar--image" src="../../users/profiles/378767.webp" data-jdenticon-width="32" data-jdenticon-height="32" data-jdenticon-value="megido" /> </a> <div class="s-user-card--info"> <a href="../../users/378767/megido" class="s-user-card--link">megido</a> <ul class="s-user-card--awards"> <li class="s-user-card--rep" title="reputation score">4,135</li> <li class="s-award-bling s-award-bling__gold" title="6 gold badges">6</li> <li class="s-award-bling s-award-bling__silver" title="29 silver badges">29</li> <li class="s-award-bling s-award-bling__bronze" title="33 bronze badges">33</li> </ul> </div> </div> </div> </div> </div> </div> </div> <div class="mln24"> <div class="question-summary" id="question-summary-57593894"> <div class="statscontainer"> <div class="stats"> <div class="vote"> <div class="votes"> <span class="vote-count-post"><strong>4</strong></span> <div class="viewcount">votes</div> </div> </div> <div class="status "> <strong>4</strong> answers </div> </div> </div> <div class="summary"> <h3><a href="../../questions/57593894/inheritance-model-update-to-its-parent-model" class="question-hyperlink">Inheritance model update to its parent model</a></h3> <div class="excerpt">I need extend a model from another model. Case: core/models.py class Master(models.Model): code = models.CharField(max_length=30, unique=True) name = models.CharField(max_length=100, blank=False, null=False) class Meta: abstract…</div> <div class="grid ai-start jc-space-between fw-wrap"> <div class="grid gs4 fw-wrap tags "> <a href="../../questions/tagged/python" class="post-tag grid--cell" title="show questions tagged 'python'" rel="tag">python</a> <a href="../../questions/tagged/django" class="post-tag grid--cell" title="show questions tagged 'django'" rel="tag">django</a> <a href="../../questions/tagged/django-inheritance" class="post-tag grid--cell" title="show questions tagged 'django-inheritance'" rel="tag">django-inheritance</a> </div> <div class="started mt0"> <div class="s-user-card s-user-card"> <time class="s-user-card--time" datetime="asked Aug 21 '19 at 14:25">asked Aug 21 '19 at 14:25</time> <a href="../../users/3802430/oegpyg" class="s-avatar s-avatar__32 s-user-card--avatar"> <img class="s-avatar--image" src="../../users/profiles/3802430.webp" data-jdenticon-width="32" data-jdenticon-height="32" data-jdenticon-value="oegpyg" /> </a> <div class="s-user-card--info"> <a href="../../users/3802430/oegpyg" class="s-user-card--link">oegpyg</a> <ul class="s-user-card--awards"> <li class="s-user-card--rep" title="reputation score">103</li> <li class="s-award-bling s-award-bling__bronze" title="7 bronze badges">7</li> </ul> </div> </div> </div> </div> </div> </div> </div> <div class="mln24"> <div class="question-summary" id="question-summary-40798279"> <div class="statscontainer"> <div class="stats"> <div class="vote"> <div class="votes"> <span class="vote-count-post"><strong>4</strong></span> <div class="viewcount">votes</div> </div> </div> <div class="status answered-accepted"> <strong>1</strong> answer </div> </div> </div> <div class="summary"> <h3><a href="../../questions/40798279/django-s-mutitable-vs-abstract-inheritance" class="question-hyperlink">Django's MutiTable Vs. Abstract Inheritance</a></h3> <div class="excerpt">While there is general consensus that multi-table inheritance isn't a very good idea in the long term (Jacobian, Others), am wondering if in some use cases the "extra joins" created by django during querying might be worth it. My issue is having a…</div> <div class="grid ai-start jc-space-between fw-wrap"> <div class="grid gs4 fw-wrap tags "> <a href="../../questions/tagged/django" class="post-tag grid--cell" title="show questions tagged 'django'" rel="tag">django</a> <a href="../../questions/tagged/inheritance" class="post-tag grid--cell" title="show questions tagged 'inheritance'" rel="tag">inheritance</a> <a href="../../questions/tagged/django-models" class="post-tag grid--cell" title="show questions tagged 'django-models'" rel="tag">django-models</a> <a href="../../questions/tagged/multiple-inheritance" class="post-tag grid--cell" title="show questions tagged 'multiple-inheritance'" rel="tag">multiple-inheritance</a> <a href="../../questions/tagged/django-inheritance" class="post-tag grid--cell" title="show questions tagged 'django-inheritance'" rel="tag">django-inheritance</a> </div> <div class="started mt0"> <div class="s-user-card s-user-card"> <time class="s-user-card--time" datetime="asked Nov 25 '16 at 05:28">asked Nov 25 '16 at 05:28</time> <a href="../../users/1082673/lukik" class="s-avatar s-avatar__32 s-user-card--avatar"> <img class="s-avatar--image" src="../../users/profiles/1082673.webp" data-jdenticon-width="32" data-jdenticon-height="32" data-jdenticon-value="lukik" /> </a> <div class="s-user-card--info"> <a href="../../users/1082673/lukik" class="s-user-card--link">lukik</a> <ul class="s-user-card--awards"> <li class="s-user-card--rep" title="reputation score">3,919</li> <li class="s-award-bling s-award-bling__gold" title="6 gold badges">6</li> <li class="s-award-bling s-award-bling__silver" title="46 silver badges">46</li> <li class="s-award-bling s-award-bling__bronze" title="89 bronze badges">89</li> </ul> </div> </div> </div> </div> </div> </div> </div> <div class="mln24"> <div class="question-summary" id="question-summary-30413011"> <div class="statscontainer"> <div class="stats"> <div class="vote"> <div class="votes"> <span class="vote-count-post"><strong>4</strong></span> <div class="viewcount">votes</div> </div> </div> <div class="status "> <strong>2</strong> answers </div> </div> </div> <div class="summary"> <h3><a href="../../questions/30413011/django-filter-queryset-by-attribute-subclass" class="question-hyperlink">Django filter queryset by attribute subclass</a></h3> <div class="excerpt">I have a Slug model to identify Page objects. A BlogPost inherits from Page. I want to find a BlogPost given a Slug name, but no other Page objects. EDIT: added models class Slug(models.Model): name = models.CharField() page =…</div> <div class="grid ai-start jc-space-between fw-wrap"> <div class="grid gs4 fw-wrap tags "> <a href="../../questions/tagged/django" class="post-tag grid--cell" title="show questions tagged 'django'" rel="tag">django</a> <a href="../../questions/tagged/django-queryset" class="post-tag grid--cell" title="show questions tagged 'django-queryset'" rel="tag">django-queryset</a> <a href="../../questions/tagged/django-inheritance" class="post-tag grid--cell" title="show questions tagged 'django-inheritance'" rel="tag">django-inheritance</a> </div> <div class="started mt0"> <div class="s-user-card s-user-card"> <time class="s-user-card--time" datetime="asked May 23 '15 at 13:03">asked May 23 '15 at 13:03</time> <a href="../../users/1888983/jozxyqk" class="s-avatar s-avatar__32 s-user-card--avatar"> <img class="s-avatar--image" src="../../users/profiles/1888983.webp" data-jdenticon-width="32" data-jdenticon-height="32" data-jdenticon-value="jozxyqk" /> </a> <div class="s-user-card--info"> <a href="../../users/1888983/jozxyqk" class="s-user-card--link">jozxyqk</a> <ul class="s-user-card--awards"> <li class="s-user-card--rep" title="reputation score">16,424</li> <li class="s-award-bling s-award-bling__gold" title="12 gold badges">12</li> <li class="s-award-bling s-award-bling__silver" title="91 silver badges">91</li> <li class="s-award-bling s-award-bling__bronze" title="180 bronze badges">180</li> </ul> </div> </div> </div> </div> </div> </div> </div> <div class="mln24"> <div class="question-summary" id="question-summary-2054831"> <div class="statscontainer"> <div class="stats"> <div class="vote"> <div class="votes"> <span class="vote-count-post"><strong>4</strong></span> <div class="viewcount">votes</div> </div> </div> <div class="status answered-accepted"> <strong>1</strong> answer </div> </div> </div> <div class="summary"> <h3><a href="../../questions/2054831/how-to-provide-a-default-value-for-base-class-attribute-from-subclass-in-djang" class="question-hyperlink">How to provide a default value for base class attribute from subclass in Django?</a></h3> <div class="excerpt">Scenario: class BaseClass(models.Model): base_field = models.CharField(max_length=15, default=None) class SubClass(BaseClass): # TODO set default value if base_field's value is None ... ie. I need to be able to load a fixture into the…</div> <div class="grid ai-start jc-space-between fw-wrap"> <div class="grid gs4 fw-wrap tags "> <a href="../../questions/tagged/python" class="post-tag grid--cell" title="show questions tagged 'python'" rel="tag">python</a> <a href="../../questions/tagged/django" class="post-tag grid--cell" title="show questions tagged 'django'" rel="tag">django</a> <a href="../../questions/tagged/django-models" class="post-tag grid--cell" title="show questions tagged 'django-models'" rel="tag">django-models</a> <a href="../../questions/tagged/django-inheritance" class="post-tag grid--cell" title="show questions tagged 'django-inheritance'" rel="tag">django-inheritance</a> </div> <div class="started mt0"> <div class="s-user-card s-user-card"> <time class="s-user-card--time" datetime="asked Jan 13 '10 at 06:19">asked Jan 13 '10 at 06:19</time> <a href="../../users/84274/mkelley33" class="s-avatar s-avatar__32 s-user-card--avatar"> <img class="s-avatar--image" src="../../users/profiles/84274.webp" data-jdenticon-width="32" data-jdenticon-height="32" data-jdenticon-value="mkelley33" /> </a> <div class="s-user-card--info"> <a href="../../users/84274/mkelley33" class="s-user-card--link">mkelley33</a> <ul class="s-user-card--awards"> <li class="s-user-card--rep" title="reputation score">5,323</li> <li class="s-award-bling s-award-bling__gold" title="10 gold badges">10</li> <li class="s-award-bling s-award-bling__silver" title="47 silver badges">47</li> <li class="s-award-bling s-award-bling__bronze" title="71 bronze badges">71</li> </ul> </div> </div> </div> </div> </div> </div> </div> <div class="mln24"> <div class="question-summary" id="question-summary-16682042"> <div class="statscontainer"> <div class="stats"> <div class="vote"> <div class="votes"> <span class="vote-count-post"><strong>4</strong></span> <div class="viewcount">votes</div> </div> </div> <div class="status "> <strong>1</strong> answer </div> </div> </div> <div class="summary"> <h3><a href="../../questions/16682042/subclassing-abstractuser-in-django-for-two-types-of-users" class="question-hyperlink">Subclassing AbstractUser in Django for two types of users</a></h3> <div class="excerpt">I'm developing a school database system in Django 1.5, and was planning on having a number of different user types (Student, Staff, Parent) which subclass AbstractUser (actually, another abstract subclass of AbstractUser). I was just attempting to…</div> <div class="grid ai-start jc-space-between fw-wrap"> <div class="grid gs4 fw-wrap tags "> <a href="../../questions/tagged/django" class="post-tag grid--cell" title="show questions tagged 'django'" rel="tag">django</a> <a href="../../questions/tagged/django-models" class="post-tag grid--cell" title="show questions tagged 'django-models'" rel="tag">django-models</a> <a href="../../questions/tagged/django-users" class="post-tag grid--cell" title="show questions tagged 'django-users'" rel="tag">django-users</a> <a href="../../questions/tagged/django-1.5" class="post-tag grid--cell" title="show questions tagged 'django-1.5'" rel="tag">django-1.5</a> <a href="../../questions/tagged/django-inheritance" class="post-tag grid--cell" title="show questions tagged 'django-inheritance'" rel="tag">django-inheritance</a> </div> <div class="started mt0"> <div class="s-user-card s-user-card"> <time class="s-user-card--time" datetime="asked May 22 '13 at 01:23">asked May 22 '13 at 01:23</time> <a href="../../users/224511/askvictor" class="s-avatar s-avatar__32 s-user-card--avatar"> <img class="s-avatar--image" src="../../users/profiles/224511.webp" data-jdenticon-width="32" data-jdenticon-height="32" data-jdenticon-value="askvictor" /> </a> <div class="s-user-card--info"> <a href="../../users/224511/askvictor" class="s-user-card--link">askvictor</a> <ul class="s-user-card--awards"> <li class="s-user-card--rep" title="reputation score">3,621</li> <li class="s-award-bling s-award-bling__gold" title="4 gold badges">4</li> <li class="s-award-bling s-award-bling__silver" title="32 silver badges">32</li> <li class="s-award-bling s-award-bling__bronze" title="45 bronze badges">45</li> </ul> </div> </div> </div> </div> </div> </div> </div> <div class="s-pagination pager fr"> <div class="s-pagination--item is-selected">1</div> <a class="s-pagination--item" href="../../questions/tagged/django-inheritance_page=2" rel="" title="Go to page 2">2</a> <a class="s-pagination--item" href="../../questions/tagged/django-inheritance_page=3" rel="" title="Go to page 3">3</a> <a class="s-pagination--item" href="../../questions/tagged/django-inheritance_page=4" rel="" title="Go to page 4">4</a> <a class="s-pagination--item" href="../../questions/tagged/django-inheritance_page=5" rel="" title="Go to page 5">5</a> <a class="s-pagination--item" href="../../questions/tagged/django-inheritance_page=6" rel="" title="Go to page 6">6</a> <a class="s-pagination--item" href="../../questions/tagged/django-inheritance_page=2" rel="next" title="Go to page 2"> Next</a> </div> </div> </div> </div> </div> <script src="../../static/js/stack-icons.js"></script> <script src="../../static/js/fromnow.js"></script> </body> </html>