Add docstring to PageRev

This commit is contained in:
Skia 2015-12-09 11:22:50 +01:00
parent 268a33255b
commit 376b5101c1
2 changed files with 8 additions and 1 deletions

View File

@ -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)

View File

@ -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):