(apps, schema_editor)
Change all spam status to Post.CLOSED.
Change all spam status to Post.CLOSED.
Change all spam status to Post . CLOSED .
def change_spam(apps, schema_editor):
    """
    Change all spam status to Post.CLOSED.
    """
    Post = apps.get_model('forum', 'Post')

    # Possible spam states.
    SPAM, NOT_SPAM, DEFAULT = range(3)
    # Post statuses.
    PENDING, OPEN, OFFTOPIC, CLOSED, DELETED = range(5)

    spam = Post.objects.filter(spam=SPAM)

    for s in spam:
        s.status = CLOSED
        s.save()
def change_spam ( apps , schema_editor ) : Post = apps . get_model ( 'forum' , 'Post' ) # Possible spam states. SPAM , NOT_SPAM , DEFAULT = range ( 3 ) # Post statuses. PENDING , OPEN , OFFTOPIC , CLOSED , DELETED = range ( 5 ) spam = Post . objects . filter ( spam = SPAM ) for s in spam : s . status = CLOSED s . save ( )