X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/8a9226b9c80c99c82702fba212f7a7241dc14c7e..24f9c4d8d1396218a125e4b4bbfce780fa3be243:/src/documents/models/chunk.py?ds=sidebyside diff --git a/src/documents/models/chunk.py b/src/documents/models/chunk.py index 61aa5177..2698b58f 100644 --- a/src/documents/models/chunk.py +++ b/src/documents/models/chunk.py @@ -39,6 +39,20 @@ class Chunk(dvcs_models.Document): 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 # ============