-class ActiveObjectManager(models.Manager):
- use_for_related_fields = True
- def get_query_set(self):
- return super(ActiveObjectManager, self).get_query_set().filter(canceled=False)
-
-class UndeletedObjectManager(models.Manager):
- def get_query_set(self):
- return super(UndeletedObjectManager, self).get_query_set().filter(deleted=False)
-
-class GenericContent(models.Model):
- content_type = models.ForeignKey(ContentType)
- object_id = models.PositiveIntegerField()
- content_object = generic.GenericForeignKey('content_type', 'object_id')
-
- class Meta:
- abstract = True
- app_label = 'forum'
-
-class MetaContent(BaseModel):
- node = models.ForeignKey('Node', null=True, related_name='%(class)ss')
-
- def __init__(self, *args, **kwargs):
- if 'content_object' in kwargs:
- kwargs['node'] = kwargs['content_object']
- del kwargs['content_object']
-
- super (MetaContent, self).__init__(*args, **kwargs)
-
- @property
- def content_object(self):
- return self.node.leaf
-
- class Meta:
- abstract = True
- app_label = 'forum'
-