Re: django caching database object

2009-01-20 Thread Derek Payton
Malcom is absolutely right, apologies for sending untested code to the list. --Derek On Jan 20, 4:53 pm, Malcolm Tredinnick wrote: > On Tue, 2009-01-20 at 11:00 -0800, Derek Payton wrote: > > The issue is that CLIENT_CHOICES is only evaluated once, when the > > server is started an all the code

Re: django caching database object

2009-01-20 Thread Malcolm Tredinnick
On Tue, 2009-01-20 at 11:00 -0800, Derek Payton wrote: > The issue is that CLIENT_CHOICES is only evaluated once, when the > server is started an all the code is loaded into memory. Try wrapping > it all in a function, thusly: > > def CLIENT_CHOICES() > choices = [ > ('', 'Select Clie

Re: django caching database object

2009-01-20 Thread Dheeraj Irukulla
That makes perfect sense. Unfortunately, it's not working. I tried your suggestion verbatim -- except added : after the CLIENT_CHOICES() function definition. Values only refresh when the server is restarted. On Tue, Jan 20, 2009 at 11:00 AM, Derek Payton wrote: > > The issue is that CLIENT_CHO

Re: django caching database object

2009-01-20 Thread Derek Payton
The issue is that CLIENT_CHOICES is only evaluated once, when the server is started an all the code is loaded into memory. Try wrapping it all in a function, thusly: def CLIENT_CHOICES() choices = [ ('', 'Select Client'), ] clients = CustomerMaster.objects.all().order_by('cust

Re: django caching database object

2009-01-20 Thread Dheeraj Irukulla
Hi Malcolm, I'm building my forms in a file called forms.py. This is how I populate the choice list: CLIENT_CHOICES = [ ('', 'Select Client'), ] clients = CustomerMaster.objects.all().order_by('customer_name') for client in clients: CLIENT_CHOICES.extend([(client.id, client.cust

Re: django caching database object

2009-01-16 Thread Malcolm Tredinnick
On Fri, 2009-01-16 at 16:26 -0800, raji wrote: > Hey django-users, > > I've got a form in my django app that contains a select box that is > dynamically generated from a db object. In this case, it's a list of > clients. > > When a user adds to the client list (via another django app), the > 'c

django caching database object

2009-01-16 Thread raji
Hey django-users, I've got a form in my django app that contains a select box that is dynamically generated from a db object. In this case, it's a list of clients. When a user adds to the client list (via another django app), the 'client' select box isn't updated with the new value(s) the next