[Django]-Django database caching

2👍

No, the value wouldn’t be cached. Your second example is the right way to go.

(The first snippet actually contains an error, in that nothing is returned from the clean method, so the id_a attribute would end up empty.)

1👍

This query is not cached. get() calls never are. QuerySets on the other hand, are (sometimes) cached after the first evaluation.

Leave a comment