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.
- [Django]-How can you emulate a mailing list in Django?
- [Django]-How to add html classes to a Django template 'for-loop' dynamically?
- [Django]-Is this how django does Single Table Inheritance?
Source:stackexchange.com