caching querysets between requests

2010-04-17 Thread HARRY POTTRER
I have a page that needs to get a few values via the aggregate function of querysets. There are about 15 of them, and they all look like this: SELECT SUM(some_column_name) FROM ... and they each take a few hundred milliseconds each. That makes the page take a lot longer to render than I'd like. I

Re: admin caching querysets

2008-12-09 Thread lingrlongr
Thanks Karen. I removed the custom form from admin.py and added a constructor to the model: def __init__(self, *args, **kwargs): super(BannerImage, self).__init__(*args, **kwargs) self._meta.get_field('url')._choices = get_urls() It seems to work now. Keith On Dec 9, 2:52 pm, "Karen Trace

Re: admin caching querysets

2008-12-09 Thread Karen Tracey
On Tue, Dec 9, 2008 at 1:58 PM, lingrlongr <[EMAIL PROTECTED]> wrote: > > I have a function called get_urls that returns a list of absolute_urls > for various models in the same project. This function is used for > another model in a way so that when a particular model appears on the > site, I ca

admin caching querysets

2008-12-09 Thread lingrlongr
I have a function called get_urls that returns a list of absolute_urls for various models in the same project. This function is used for another model in a way so that when a particular model appears on the site, I can choose which part of the site this model links to. # utils.py def get_urls():

Question abouit caching QuerySets

2008-04-30 Thread brandonl
Is there a way to disable QuerySet caching? Thanks. -Brandon --~--~-~--~~~---~--~~ 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 fr

Re: Caching querysets

2007-11-01 Thread Jeremy Dunck
On 11/1/07, Joe <[EMAIL PROTECTED]> wrote: > Correct me if I'm wrong, but wouldn't this place more load on the > server to to this, as an anonymous user visiting the site for the > first time would start a new session, and therefore bypass the cache? Sessions aren't created unless you modify a v

Re: Caching querysets

2007-11-01 Thread Joe
Sorry, meant to NOT vary on the value of the cookie header. On Nov 1, 11:39 am, Joe <[EMAIL PROTECTED]> wrote: > Correct me if I'm wrong, but wouldn't this place more load on the > server to to this, as an anonymous user visiting the site for the > first time would start a new session, and theref

Re: Caching querysets

2007-11-01 Thread Joe
Sorry for the mistake. This should read: Correct me if I'm wrong, but wouldn't this place more load on the server to to this, as an anonymous user visiting the site for the first time would start a new session, and therefore bypass the cache? Is there a way I could hack the middleware to look at

Re: Caching querysets

2007-11-01 Thread Joe
Correct me if I'm wrong, but wouldn't this place more load on the server to to this, as an anonymous user visiting the site for the first time would start a new session, and therefore bypass the cache? Is there a way I could hack the middleware to look at something besides the HTTP headers to det

Re: Caching querysets

2007-10-30 Thread Malcolm Tredinnick
On Tue, 2007-10-30 at 05:43 -0700, Joe wrote: > I am running into a performace problem with Django and scaling. > > I have enabled the caching middleware, but had to set > CACHE_MIDDLEWARE_ANONYMOUS_ONLY=True so I could continue to use the > admin interface. > > Now, authenticated users are begi

Re: Caching querysets

2007-10-30 Thread Jarek Zgoda
Joe napisał(a): > I tried to look at caching querysets, but this won't work because they > are lazy. Do a list() on query set and cache the resulting list. > If I use fragment caching, would that save hits on the database > because of the lazy querysets? Entire fragments

Caching querysets

2007-10-30 Thread Joe
implement caching on my normal views for authenticated users? I can't just use the decorator because I have a "Hello, Username" message on the page. I tried to look at caching querysets, but this won't work because they are lazy. If I use fragment caching, would that save

Re: Database caching, querysets not evaluating?

2007-07-08 Thread Benjamin Slavin
You may want to take a look here: http://groups.google.com/group/django-users/browse_thread/thread/e4e1e0c017655ad/ On 7/8/07, ejot <[EMAIL PROTECTED]> wrote: > > And continuing this monologue :) ... the separate thread ofcourse > didnt quite work as I intended. I see now that a new connecti

Re: Database caching, querysets not evaluating?

2007-07-08 Thread ejot
And continuing this monologue :) ... the separate thread ofcourse didnt quite work as I intended. I see now that a new connection is created for each thread/polling I create. This brings me back to the original question... how can I force a query to evaluate? Or is there some alternative to solve

Re: Database caching, querysets not evaluating?

2007-07-06 Thread ejot
Hmm, Im guessing this might also have something to do with local() for threads? Made my app work by using an extra and from my point of view uneccesary worker thread that does the polling on the database.. . anyone willing to offer some insight on this? I see people are trying to do external (fro

Database caching, querysets not evaluating?

2007-07-06 Thread ejot
Im really banging my head against a wall trying to get my threaded application to play nice with djangos ORM... this is what my thread does for each iteration.. def run(self): while self.keepRunning: print repr(Topic.objects.get(id=1).content_set.order_by("- id")[0])