<s> from django . db . models . signals import post_save , post_delete <EOL> from sellmo . core import indexing <EOL> from . models import Value , Attribute <EOL> def on_value_post_save ( <EOL> sender , <EOL> instance , <EOL> raw = False , <EOL> update_fields = None , <EOL> ** kwargs <EOL> ) : <EOL> if raw : <EOL> return <EOL> index = indexing . indexer . get_index ( '<STR_LIT>' ) <EOL> index . sync ( [ instance . product . pk ] ) <EOL> def on_value_post_delete ( <EOL> sender , <EOL> instance , <EOL> raw = False , <EOL> update_fields = None , <EOL> ** kwargs <EOL> ) : <EOL> if raw : <EOL> return <EOL> index = indexing . indexer . get_index ( '<STR_LIT>' ) <EOL> index . sync ( [ instance . product . pk ] ) <EOL> def on_attribute_post_save ( <EOL> sender , <EOL> instance , <EOL> raw = False , <EOL> update_fields = None , <EOL> ** kwargs <EOL> ) : <EOL> if raw : <EOL> return <EOL> index = indexing . indexer . get_index ( '<STR_LIT>' ) <EOL> index . invalidate ( ) <EOL> def on_attribute_post_delete ( <EOL> sender , <EOL> instance , <EOL> raw = False , <EOL> update_fields = None , <EOL> ** kwargs <EOL> ) : <EOL> if raw : <EOL> return <EOL> index = indexing . indexer . get_index ( '<STR_LIT>' ) <EOL> index . invalidate ( ) <EOL> post_save . connect ( on_value_post_save , sender = Value ) <EOL> post_delete . connect ( on_value_post_delete , sender = Value ) <EOL> post_save . connect ( on_attribute_post_save , sender = Attribute ) <EOL> post_delete . connect ( on_attribute_post_delete , sender = Attribute ) </s>
