def _init_visibility(self, event): self.visibility.choices = get_visibility_options(event, allow_invisible=True) # Check if event visibility would be affected by any of the categories real_horizon = event.category.real_visibility_horizon own_horizon = self._get_event_own_visibility_horizon(event) if own_horizon and real_horizon and real_horizon.is_descendant_of(own_horizon): self.visibility.warning = _("This event's visibility is currently limited by that of '{}'.").format( real_horizon.title)
def _init_visibility(self): self.visibility.choices = get_visibility_options(self.category, allow_invisible=False) # Check if category visibility would be affected by any of the parents real_horizon = self.category.real_visibility_horizon own_horizon = self.category.own_visibility_horizon if real_horizon and real_horizon.is_descendant_of(own_horizon): self.visibility.warning = _("This category's visibility is currently limited by that of '{}'.").format( real_horizon.title)
def _init_visibility(self, category): self.visibility.choices = get_visibility_options(category, allow_invisible=False) # Check if category visibility would be affected by any of the parents real_horizon = category.real_visibility_horizon own_horizon = category.own_visibility_horizon if real_horizon and real_horizon.is_descendant_of(own_horizon): self.visibility.warning = _("This category's visibility is currently limited by that of '{}'.").format( real_horizon.title)
def __init__(self, *args, **kwargs): super(CategorySettingsForm, self).__init__(*args, **kwargs) category = kwargs.pop('category') self.visibility.choices = get_visibility_options(category, allow_invisible=False) # Check if category visibility would be affected by any of the parents real_horizon = category.real_visibility_horizon own_horizon = category.own_visibility_horizon if real_horizon and real_horizon.is_descendant_of(own_horizon): self.visibility.warning = _("This category's visibility is currently limited by that of '{}'.").format( real_horizon.title)
def __init__(self, *args, **kwargs): super(CategorySettingsForm, self).__init__(*args, **kwargs) category = kwargs.pop('category') self.visibility.choices = get_visibility_options(category, allow_invisible=False) # Check if category visibility would be affected by any of the parents real_horizon = category.real_visibility_horizon own_horizon = category.own_visibility_horizon if real_horizon and real_horizon.is_descendant_of(own_horizon): self.visibility.warning = _( "This category's visibility is currently limited by that of '{}'." ).format(real_horizon.title)
def _format_visibility(event, visibility): options = dict(get_visibility_options(event, allow_invisible=True)) return options[visibility if visibility is not None else '']