model-inheritance

How can I query a model by if there is a subclass instance?

I have these two simple models, A and B: from django.db import models class A(models.Model): name = models.CharField(max_length=10) class B(A): age = models.IntegerField() Now, how can I query for all instances of A which do not have an instance of B? The only way I found requires an explicitly unique field on each subclass, wh...

Model inheritance approach with Django's ORM

Hello, I want to store events in a web application I am fooling around with and I feel quite unsure about the pros and cons of each respective approach - using inheritance extensively or in a more modest manner. Example: class Event(models.Model): moment = models.DateTimeField() class UserEvent(Event): user = models.ForeignKe...

Django: Model Inheritance: What apps should be installed?

I am in the process of setting up a rather complex data structure, where models inheriting from models are subsets of the original models file. > level_1_a > level_2_a > level_3_a > level_4_a > level_4_b > level_3_b > level_4_a > level_2_b > level_3_a > level_4_a > level_4_b ...