CMS pages have several multilingual fields such as title, slug, menu title, page title, description meta tag, and overwrite URL. They also have several common nonlanguage-specific fields such as template, ID used in template tags, attached application, and attached menu. However, that might not be enough for more complex websites. Thankfully, Django CMS features a manageable mechanism to add new database fields for CMS pages. In this recipe, you will see how to add fields for the CSS classes for the navigational menu items and page body.
To create a CMS page extension with the CSS class fields for the navigational menu items and page body, follow these steps:
In the
models.py
file, create aCSSExtension
class extendingPageExtension
and put fields for the menu item's CSS class and<body>
CSS class, as follows:# cms_extensions/models.py # ...