Use class name rather than database name for body classes
This avoids duplication and makes the classnames a bit shorter, and more sane.
This commit is contained in:
parent
ba7a2d7b4d
commit
71c08f5568
2 changed files with 3 additions and 2 deletions
|
@ -1,4 +1,4 @@
|
|||
body.page-home-homepage {
|
||||
body.page-homepage {
|
||||
main {
|
||||
background-repeat: no-repeat;
|
||||
background-size: cover;
|
||||
|
|
|
@ -4,6 +4,7 @@ from typing import Any, Optional
|
|||
from django.db import models
|
||||
from django.http.request import HttpRequest
|
||||
from django.utils.functional import cached_property, classproperty
|
||||
from django.utils.text import slugify
|
||||
from wagtail.admin.panels import FieldPanel
|
||||
from wagtail.fields import StreamField
|
||||
from wagtail.images import get_image_model_string
|
||||
|
@ -26,7 +27,7 @@ class BasePage(Page):
|
|||
|
||||
@classproperty
|
||||
def body_class(cls) -> str:
|
||||
return "page-" + cls._meta.db_table.replace("_", "-")
|
||||
return "page-" + slugify(cls.__name__)
|
||||
|
||||
def get_parent_pages(self) -> PageQuerySet:
|
||||
"""
|
||||
|
|
Loading…
Reference in a new issue