placeholder_detail_bottom = PlaceholderField( 'newsblog_detail_bottom', related_name='aldryn_newsblog_detail_bottom', ) placeholder_detail_footer = PlaceholderField( 'newsblog_detail_footer', related_name='aldryn_newsblog_detail_footer', ) def get_app_title(self): return getattr(self, 'app_title', _('untitled')) class Meta: verbose_name = _('application configuration') verbose_name_plural = _('application configurations') class NewsBlogConfigForm(AppDataForm): default_published = forms.BooleanField( label=_(u'Post published by default'), required=False, initial=getattr(settings, 'ALDRYN_NEWSBLOG_DEFAULT_PUBLISHED', False)) setup_config(NewsBlogConfigForm, NewsBlogConfig) if ENABLE_REVERSION: from aldryn_reversion.core import version_controlled_content NewsBlogConfig = version_controlled_content(NewsBlogConfig)
def __str__(self): return ugettext('%s tags') % (self.app_config.get_app_title(), ) @receiver(post_save, dispatch_uid='article_update_search_data') def update_search_data(sender, instance, **kwargs): """ Upon detecting changes in a plugin used in an Article's content (PlaceholderField), update the article's search_index so that we can perform simple searches even without Haystack, etc. """ is_cms_plugin = issubclass(instance.__class__, CMSPlugin) if Article.update_search_on_save and is_cms_plugin: placeholder = (getattr(instance, '_placeholder_cache', None) or instance.placeholder) if hasattr(placeholder, '_attached_model_cache'): if placeholder._attached_model_cache == Article: article = placeholder._attached_model_cache.objects.language( instance.language).get(content=placeholder.pk) article.search_data = article.get_search_data( instance.language) article.save() if ENABLE_REVERSION: from aldryn_reversion.core import version_controlled_content Article = version_controlled_content(Article, follow=['app_config']) Article = python_2_unicode_compatible(Article)