Hello,

I've written a few decorators for my views. Each of the decorators operate
on the same object obtained from the db backend using ORM and each checks
different things.  I'll chain them together sometimes,  but not always.  In
the decorated view I'll usually be doing yet another
MyObjectClass.objects.get(...) (as I've done in each of the decorators
already) to carry out some operation or other on the object.

My question is,  is there some way to either avoid having to make repeated
ORM queries in each of the decorators or to cache the result of the first
ORM query (no matter which decorator it's obtained from)? All I'm usually
doing it a .get(id=123) to get an object to work on and it feels wasteful.

Is some form of middleware to cache db queries the "done thing" here?  Not
sure where to start.

Thanks for any help!
Mark

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to