Python wagtail model class PageRevision

Python wagtail model class PageRevision

In the previous article we explored model class Site .If you haven't gone through that,then please click on this link  wagtail core model Site In this article we will explore model class PageRevision.First of all we have to know what is the use of PageRevision model and how it can be created.

Every time a page is edited a new PageRevision is created and saved to the database. It can be used to find the full history of all changes that have been made to a page and it also provides a place for new changes to be kept before going live.

  •   Revisions can be created from any page object by calling its save_revision() method
  •   The content of the page is JSON-serialised and stored in the content_json field
  •   You can retrieve a PageRevision as a Page object by calling the as_page_object() method

        Now we learn about different type of Datebase fields and Method and properties of


                        Database fields

  • submitted_for_moderation (boolean)
             True if this revision is in moderation
  • created_at  (date/time)     
              This is the time the revision was created
  • user  (foreign key to user model)   
              This links to the user that created the revision
  • content_json  (text)   
             This field contains the JSON content for the page at the time the revision was created 
                Methods and properties

  • as_page_object()
              This method retrieves this revision as an instance of its Page subclass.
  • approve_moderation()    
            Calling this on a revision that's in moderation will mark it as approved and publish it
  • reject_moderation()
              Calling this on a revision that's in moderation will mark it as rejected
  • is_latest_revision()
              Returns  True if this revision is its page's latest revision
  • publish()
              Calling this will copy the content of this revision into the live page object. If the page is in draft, it will                               be published.


Name Views Likes
C++ Exception Handling-|| 67 3
C++ Exception Handling 102 3
C++ File Handling EOF 81 5
C++ File Handling Error Handling During file Operation 930 5
C++ File Handling seekp() Function 90 5
C++ File Handling seekg() Function 78 6
C++ File Handling tellg() Function 107 5
C++ File Handling tellp() Function 95 5
C++ File Handling close() Function 69 5
C++ File Handling:: open() 89 5
C++ File Handling Introduction 121 5
C++ Container Library:: std ::array-II 92 4
Top Django Interview Questions and Answers You Need to Know 264 6
C++ Container Library::std::array 85 6
C++ Container Library Introduction 94 5
Essential Engineering Skills for Your Resume 115 5
Mistakes To Avoid During Technical Interview 122 5
Mistakes You Must Avoid During Work From Home 164 6
Seven Common Mistakes that Beginners Should Avoid While Learning to Code 94 6
Simple Linear Regression 89 6
Python wagtailmenus 108 6
Python wagtail application 109 6
Python guppy GSL 119 5
Python wagtail guppy subpackage heapy 163 6
Python guppy Introduction 204 6
Python wagtail Structural Block 242 6
Python wagtail Integrating into Django Project 335 6
Python wagtail testing 265 7
Python wagtail Basic Block 314 7
Python wagtail image tag 209 7
Python wagtail Templates 167 6
Python wagtail Backends 187 6
Python wagtail Indexing 172 6
Python wagtail Search 166 7
Python wagtail Snippets 179 6
Python wagtail Writing your own page models 156 9
Python wagtail model class PageRevision 182 10
Python wagtail model class Site 191 9
Python wagtail wagtail core model 210 9
Python wagtail page models 179 10
Python wagtail 154 11