X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/8830e06ad0b466c40747540b5122e6825114a90a..9249e6ddc35e7cc7077fa5035fbc27397fbb70a9:/apps/wiki/helpers.py?ds=sidebyside diff --git a/apps/wiki/helpers.py b/apps/wiki/helpers.py index ee26c5a2..fe4b3b86 100644 --- a/apps/wiki/helpers.py +++ b/apps/wiki/helpers.py @@ -143,3 +143,28 @@ def active_tab(tab): return wrapped return wrapper + +class BookChunks(object): + """ + Yields the chunks of a book. + """ + + def __init__(self, book): + self.book = book + + @property + def chunks(self): + return self.book.chunk_set.all() + + +class ChoiceChunks(BookChunks): + """ + Associates the given chunks iterable for a book. + """ + + chunks = None + + def __init__(self, book, chunks): + self.book = book + self.chunks = chunks +