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...
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...
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
...