Last active
February 16, 2020 14:31
-
-
Save dchuvardynskyi/6a2e8d3fdb3e160d6f55de468c173dce to your computer and use it in GitHub Desktop.
Cache Property Decorator example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from cached_property import cached_property | |
| class SomeView: | |
| ... | |
| @cached_property | |
| def get_order(): | |
| order = get_object_or_404(Order, pk=self.self.kwargs['order_id']) | |
| return order |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment