[docs]classSiteLogStatus(IntegerChoices,p("help")):_symmetric_builtins_=[s("name",case_fold=True)]# fmt: offFORMER=1,_("Former"),_("Site is no longer maintained and logs are not published.")PROPOSED=2,_("Proposed"),_("This is a new Site that has never been published.")UPDATED=3,_("Updated"),_("Site log or section has unpublished updates.")PUBLISHED=4,_("Published"),_("Site log or section is published with no unpublished changes.")EMPTY=5,_("Empty"),_("Site log section is empty or deleted.")SUSPENDED=6,_("Suspended"),_("Site has been temporarily suspended and does not appear in public data.")# fmt: on@propertydefcss(self):returnf"slm-status-{self.label.lower().replace(' ','-')}"@propertydefcolor(self):fromdjango.confimportsettingsreturngetattr(settings,"SLM_STATUS_COLORS",{}).get(self,None)
[docs]defmerge(self,sibling):""" Returns the correct status value to use when sibling status values are being combined into one parent status value. """ifsiblingisnotNoneandsibling.value<self.value:returnsiblingreturnself
[docs]defset(self,child):""" Returns the correct status value to use when this status is being set to the aggregate status of its children. """ifselfin{SiteLogStatus.PUBLISHED,SiteLogStatus.UPDATED,SiteLogStatus.EMPTY,}:returnchildreturnself.merge(child)