[Fixed]-Can not iterate over results of a cached queryset in Django

1👍

You seem to be using the article slug as the key to get/set the comments in the cache. I guess that elsewhere, in code you haven’t shown, you’re using that same key to cache an actual Article (which would make sense), and that’s what you’re retrieving in this code.

You might want to disambiguate them by using "comments:%s" % post_slug as the cache key.

Leave a comment