<s> from django . contrib . contenttypes import models as ct_models <EOL> from nodeconductor . logging import models <EOL> def remove_related_alerts ( sender , instance , ** kwargs ) : <EOL> content_type = ct_models . ContentType . objects . get_for_model ( instance ) <EOL> for alert in models . Alert . objects . filter ( <EOL> object_id = instance . id , content_type = content_type , closed__isnull = True ) . iterator ( ) : <EOL> alert . close ( ) </s>
