<s> from . models import Post <EOL> from django . db import models <EOL> from django . db . models . signals import pre_save , post_save <EOL> try : <EOL> from django . dispatch import receiver <EOL> except ImportError : <EOL> def receiver ( signal , ** kwargs ) : <EOL> def _decorator ( func ) : <EOL> signal . connect ( func , ** kwargs ) <EOL> return func <EOL> return _decorator <EOL> from minicms . models import Page <EOL> Page . add_to_class ( '<STR_LIT>' , <EOL> models . BooleanField ( default = False , editable = False ) ) <EOL> @ receiver ( pre_save , sender = Page ) <EOL> def update_dependency_field ( sender , instance , ** kwargs ) : <EOL> instance . depends_on_blog_posts = '<STR_LIT>' in instance . content <EOL> @ receiver ( post_save , sender = Post ) <EOL> def update_blog_dependencies ( sender , ** kwargs ) : <EOL> for page in Page . objects . filter ( depends_on_blog_posts = True ) : <EOL> page . save ( ) </s>
