def clear_cached_posts(sender, instance, **kwargs):
    try:
        saved_instance = sender.objects.get(pk=instance.pk)
    except sender.DoesNotExist:
        saved_instance = None
    #
    # TODO: only kill the cache if items have changed .
    # e.g if the description, title, slug has changed nuke the
    #       index
    #       archive
    #
    kill_list = []
    # dates
    if getattr(saved_instance, 'created', None) != instance.created:
        kill_list.append(get_key('archive_dates'))
        kill_list.append(
            get_key('month_%s_%s' % (
                instance.created.year,
                instance.created.month)))
    try:
        kill_list.append(
            get_key('month_%s_%s' % (
                saved_instance.created.year,
                saved_instance.created.month)))
    except AttributeError:
        pass

    # Just nuke all of the below for now
    kill_list.append(get_key('posts_published'))
    kill_list.append(get_key('posts_idea'))
    kill_list.append(get_key('posts_draft'))
    kill_list.append(get_key('posts_hidden'))
    kill_list.append(get_key('tags_and_counts'))
    kill_list.append(get_key('index_'))

    # always nuke the post
    kill_list.append(get_key('post_%s' % instance.slug))

    # nuke tags
    try:
        for tag in instance.tags.all():
            kill_list.append(get_key('tag_%s' % tag))
    except ValueError:
        pass
    cache.delete_many(kill_list)
Get response status code as int.
dataset/ETHPy150Open jamiecurle/django-omblog/omblog/listeners.py/clear_cached_posts--crossover with--dataset/ETHPy150Open michaelliao/transwarp/transwarp/web.py/Response.status_code