Add is_published property

This commit is contained in:
Iacopo Spalletti 2016-03-26 01:19:49 +01:00
parent 12f2544ad5
commit 30ea472372

View file

@ -285,6 +285,13 @@ class Post(ModelMeta, TranslatableModel):
def get_full_url(self):
return self.build_absolute_uri(self.get_absolute_url())
@property
def is_published(self):
return (self.publish and
(self.date_published and self.date_published <= timezone.now()) and
(self.date_published_end is None or self.date_published_end > timezone.now())
)
class BasePostPlugin(CMSPlugin):
app_config = AppHookConfigField(