]> git.openstreetmap.org Git - osqa.git/commitdiff
fixes several issues with the static pages
authorhernani <hernani@0cfe37f9-358a-4d5e-be75-b63607b5c754>
Fri, 4 Feb 2011 17:59:52 +0000 (17:59 +0000)
committerhernani <hernani@0cfe37f9-358a-4d5e-be75-b63607b5c754>
Fri, 4 Feb 2011 17:59:52 +0000 (17:59 +0000)
git-svn-id: http://svn.osqa.net/svnroot/osqa/trunk@743 0cfe37f9-358a-4d5e-be75-b63607b5c754

forum/models/page.py

index ff3b1a4e7ac925217865eaff4ca9cc481bfc3632..665a1be837ac395d2c1323f1487d0986b14e2b45 100644 (file)
@@ -8,6 +8,10 @@ class Page(Node):
     def published(self):
         return self.marked
 
     def published(self):
         return self.marked
 
+    @property
+    def html(self):
+        return self._as_markdown(self.body)
+
     def save(self, *args, **kwargs):
         old_options = self._original_state.get('extra', None)
 
     def save(self, *args, **kwargs):
         old_options = self._original_state.get('extra', None)
 
@@ -33,8 +37,18 @@ class Page(Node):
     @models.permalink
     def get_absolute_url(self):
         return ('static_page', (), {'path': self.extra['path']})
     @models.permalink
     def get_absolute_url(self):
         return ('static_page', (), {'path': self.extra['path']})
+        
+    def activate_revision(self, user, revision, extensions=['urlize']):
+        self.title = revision.title
+        self.tagnames = revision.tagnames        
+        self.body = revision.body
+
+        self.active_revision = revision
+        self.update_last_activity(user)
+
+        self.save()
 
     class Meta(Node.Meta):
         proxy = True
 
 
     class Meta(Node.Meta):
         proxy = True
 
-    
\ No newline at end of file
+