Python wagtail Writing your own page models














































Python wagtail Writing your own page models



In the previous few article we explored different type of wagtail core model and discuss each type briefly one by one.You can see my previous article for more information.In this article we will focus on what are the different type of think you need to focus while writing your own page models.
  Database fields

Each Wagtail page type is a Django model, represented in the database as a separate table.

Each page type can have its own set of fields. 

          For example:-A news article may have body text and a published date, whereas an event page may need                                           separate fields for venue and start/finish times.

Wagtail also provides a couple of field classes of its own:

  1. RichTextField - For rich text content
  2. StreamField - A block-based content field

                                  Search

Wagtail provides a comprehensive and extensible search interface. In addition, it provides ways to promote search results through "Editor's Picks". Wagtail also collects simple statistics on queries made through the search interface.

The search_fields attribute defines which fields are added to the search index and how they are indexed.

                            

                      Editor panels


There are a few attributes for defining how the page's fields will be arranged in the page editor interface:
   
  1.  content_panels - For content, such as main body text
  2. promote_panels - For metadata, such as tags, thumbnail image and SEO title
  3. settings_panels - For settings, such as publish date

Each of these attributes is set to a list of 
EditHandler objects, which defines which fields appear on which tabs and how they are structured on each tab.
                  
            

                         Page URLs


The most common method of retrieving page URLs is by using the {% pageurl %} template tag.

Page models also include several low-level methods for overriding or accessing page URLs.



More Articles of SAYENDEEP MAHANTY:

Name Views Likes
C++ Exception Handling-|| 86 3
C++ Exception Handling 117 3
C++ File Handling EOF 94 5
C++ File Handling Error Handling During file Operation 1135 5
C++ File Handling seekp() Function 106 5
C++ File Handling seekg() Function 106 6
C++ File Handling tellg() Function 127 5
C++ File Handling tellp() Function 133 5
C++ File Handling close() Function 78 5
C++ File Handling:: open() 107 5
C++ File Handling Introduction 132 5
C++ Container Library:: std ::array-II 102 4
Top Django Interview Questions and Answers You Need to Know 303 6
C++ Container Library::std::array 97 6
C++ Container Library Introduction 104 5
Essential Engineering Skills for Your Resume 128 5
Mistakes To Avoid During Technical Interview 134 5
Mistakes You Must Avoid During Work From Home 179 6
Seven Common Mistakes that Beginners Should Avoid While Learning to Code 109 6
Simple Linear Regression 96 6
Python wagtailmenus 123 6
Python wagtail application 120 6
Python guppy GSL 136 5
Python wagtail guppy subpackage heapy 174 6
Python guppy Introduction 215 6
Python wagtail Structural Block 258 6
Python wagtail Integrating into Django Project 370 6
Python wagtail testing 281 7
Python wagtail Basic Block 349 7
Python wagtail image tag 216 7
Python wagtail Templates 180 6
Python wagtail Backends 207 6
Python wagtail Indexing 190 6
Python wagtail Search 174 7
Python wagtail Snippets 192 6
Python wagtail Writing your own page models 166 9
Python wagtail model class PageRevision 196 10
Python wagtail model class Site 199 9
Python wagtail wagtail core model 219 9
Python wagtail page models 189 10
Python wagtail 166 11

Comments