Use Django's method for class properties
This commit is contained in:
parent
d5d0b293f7
commit
6d27add843
1 changed files with 2 additions and 2 deletions
|
@ -1,4 +1,5 @@
|
||||||
from django.db import models
|
from django.db import models
|
||||||
|
from django.utils.functional import classproperty
|
||||||
from wagtail.admin.panels import FieldPanel
|
from wagtail.admin.panels import FieldPanel
|
||||||
from wagtail.models import Page
|
from wagtail.models import Page
|
||||||
|
|
||||||
|
@ -7,8 +8,7 @@ class BasePage(Page):
|
||||||
class Meta:
|
class Meta:
|
||||||
abstract = True
|
abstract = True
|
||||||
|
|
||||||
@classmethod
|
@classproperty
|
||||||
@property
|
|
||||||
def body_class(cls) -> str:
|
def body_class(cls) -> str:
|
||||||
return "page-" + cls._meta.db_table.replace("_", "-")
|
return "page-" + cls._meta.db_table.replace("_", "-")
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue