gallery_start = models.IntegerField(_('gallery start'), null=True, blank=True, default=1)
# cache
- _hidden = models.NullBooleanField(editable=False)
- _changed = models.NullBooleanField(editable=False)
- _new_publishable = models.NullBooleanField(editable=False)
+ _hidden = models.BooleanField(editable=False, null=True)
+ _changed = models.BooleanField(editable=False, null=True)
+ _new_publishable = models.BooleanField(editable=False, null=True)
# managers
objects = models.Manager()
verbose_name_plural = _('chunks')
permissions = [('can_pubmark', 'Can mark for publishing')]
+ @classmethod
+ def get_visible_for(cls, user):
+ qs = cls.objects.all()
+ if not user.is_authenticated:
+ qs = qs.filter(book__public=True)
+ return qs
+
+ @classmethod
+ def get_revisions_visible_for(cls, user):
+ qs = cls.change_model.objects.all()
+ if not user.is_authenticated:
+ qs = qs.filter(tree__book__public=True)
+ return qs
+
# Representing
# ============