<s> from __future__ import unicode_literals <EOL> import uuid <EOL> from django . db import models , migrations <EOL> def init_is_closed_attribute ( apps , schema_editor ) : <EOL> Alert = apps . get_model ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> for alert in Alert . objects . all ( ) : <EOL> if alert . closed is None : <EOL> ( Alert . objects <EOL> . filter ( object_id = alert . object_id , <EOL> content_type = alert . content_type , <EOL> alert_type = alert . alert_type , <EOL> closed__isnull = True ) <EOL> . delete ( ) ) <EOL> else : <EOL> alert . is_closed = uuid . uuid4 ( ) . hex <EOL> alert . save ( ) <EOL> class Migration ( migrations . Migration ) : <EOL> replaces = [ ( '<STR_LIT>' , '<STR_LIT>' ) ] <EOL> dependencies = [ <EOL> ( '<STR_LIT>' , '<STR_LIT>' ) , <EOL> ] <EOL> operations = [ <EOL> migrations . AddField ( <EOL> model_name = '<STR_LIT>' , <EOL> name = '<STR_LIT>' , <EOL> field = models . CharField ( max_length = <NUM_LIT:32> , blank = True ) , <EOL> preserve_default = True , <EOL> ) , <EOL> migrations . RunPython ( init_is_closed_attribute ) , <EOL> migrations . AlterUniqueTogether ( <EOL> name = '<STR_LIT>' , <EOL> unique_together = set ( [ ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ) ] ) , <EOL> ) , <EOL> ] </s>
