Use Django's method for class properties

This commit is contained in:
Jake Howard 2022-06-14 22:30:39 +01:00
parent d5d0b293f7
commit 6d27add843
Signed by: jake
GPG key ID: 57AFB45680EDD477

View file

@ -1,4 +1,5 @@
from django.db import models
from django.utils.functional import classproperty
from wagtail.admin.panels import FieldPanel
from wagtail.models import Page
@ -7,8 +8,7 @@ class BasePage(Page):
class Meta:
abstract = True
@classmethod
@property
@classproperty
def body_class(cls) -> str:
return "page-" + cls._meta.db_table.replace("_", "-")