Created
March 7, 2024 10:58
-
-
Save oduvan/00cd64b98f3479192b033eb23cf240f8 to your computer and use it in GitHub Desktop.
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 functools import cached_property | |
class DataProxy: | |
def __init__(self, user): | |
self.user = user | |
@cached_property | |
def plan(self): | |
return DBModel.objects.get(id=67) | |
@cached_property | |
def price_3d(self): | |
return DBModelItem.objects.get(plan=self.plan, id=67) | |
def context_manager(request): | |
return {"DATA": DataProxy(request.user)} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment