From 376b5101c108a811aaba3d9350b4676a77193fee Mon Sep 17 00:00:00 2001 From: Skia Date: Wed, 9 Dec 2015 11:22:50 +0100 Subject: [PATCH] Add docstring to PageRev --- core/models.py | 7 +++++++ core/views/page.py | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/core/models.py b/core/models.py index 1d096061..f15aba03 100644 --- a/core/models.py +++ b/core/models.py @@ -347,6 +347,13 @@ class Page(models.Model): return self.get_full_name() class PageRev(models.Model): + """ + This is the true content of the page. + Each page object has a revisions field that is a list of PageRev, ordered by date. + my_page.revisions.last() gives the PageRev object that is the most up-to-date, and thus, + is the real content of the page. + The content is in PageRev.title and PageRev.content . + """ title = models.CharField(_("page title"), max_length=255, blank=True) content = models.TextField(_("page content"), blank=True) date = models.DateTimeField(_('date'), auto_now=True) diff --git a/core/views/page.py b/core/views/page.py index c8cbd13e..fbcaada2 100644 --- a/core/views/page.py +++ b/core/views/page.py @@ -111,7 +111,7 @@ class PageEditView(CanEditMixin, UpdateView): self.page.set_lock(self.request.user) except LockError as e: raise e - return self.page.revisions.all().last() + return self.page.revisions.last() return None def get_context_data(self, **kwargs):