Re: Models not being updated when accessed by multiple processes

2010-11-26 Thread Iqbal Abdullah
-1598932/Atomic-Increment-Counter-Django Thanks JeeyoungKim for pointing to the right direction. On 11月23日, 午後5:52, Iqbal Abdullah wrote: > Since we only run the application on a single server we're using file > based locking; fail_to_get_lock() and release_lock() tries to create a > file

Re: Models not being updated when accessed by multiple processes

2010-11-23 Thread Iqbal Abdullah
e > F() object and update() methods to update the database. > > I have an example, here > > http://pastebin.com/qp4ExWC2 > > On Nov 19, 4:30 pm, Iqbal Abdullah wrote: > > > Hi Steve, > > > Ops, yes, I forgot to include the object.save() in the pseudo code > &g

Re: Models not being updated when accessed by multiple processes

2010-11-19 Thread Iqbal Abdullah
t the object so we can have the latest state 6 object.value = object.value - 1 7 object.save() 8 print object.value# returns 4 9 object.release_lock() On 11月20日, 午前7:39, Steve Holden wrote: > On 11/19/2010 5:35 PM, Iqbal Abdullah wrote: > > > Hi, > > > This might be a

Models not being updated when accessed by multiple processes

2010-11-19 Thread Iqbal Abdullah
Hi, This might be a gotcha on the models side, but I would like clarification and guidance on how to write the code better concerning multiple process accessing the same data via models. I have a backend script that runs the following code in multiple processes: 1 object = MyModel.object.get(id=

Does the auto_now attribute do updates even if the same data is inserted?

2009-09-28 Thread Iqbal Abdullah
Hi guys, I have a quick question: I have set auto_now=True for one of my DateTimeFields. Lets say I have a model object like so: >> a = MyModel.objects.get(id="10") >> print a.id >> "10" >> a.id = "10" >> a.save() will this cause my DateTimeField to change it's timestamp? --~--~-~--~-

Is this a db caching issue or a sessions issue?

2009-05-21 Thread Iqbal Abdullah
Hi guys, I'm trying to figure out if what is going on with the pages i'm building and how to fix it. I have an object of User which I put into the sessions: class User: def _get_points(self): return UserModel.point.current_value def _set_points(self, value): pass points = property

Re: session through redirects

2009-05-12 Thread Iqbal Abdullah
est object not being passed around for context processing. On May 13, 12:12 am, George Song wrote: > On 5/12/2009 5:45 AM, Iqbal Abdullah wrote: > > > > > I'm confused on how to get data in request.session if a certain view > > redirects the user using HttpRespon

session through redirects

2009-05-12 Thread Iqbal Abdullah
Hi guys, I'm confused on how to get data in request.session if a certain view redirects the user using HttpResponseRedirect() A sample code: def view_start(request): try: Member(id) except Exception, e: # redirect to registration page if this id is not re

Re: UnpickleableError when sessions are saved

2009-04-13 Thread Iqbal Abdullah
Thanks Alex and matehat, Concerning this issue of mine, I've decided to remove the images and save the objects without the ImagingCore in them, which fixed the whole thing. On a different note, other than actively testing data which we want to put into sessions before we design the application f

UnpickleableError when sessions are saved

2009-04-11 Thread Iqbal Abdullah
Hi guys, In one of our views, we're getting the error below: Traceback (most recent call last): File "/usr/lib/python2.5/site-packages/django/core/servers/ basehttp.py", line 278, in run self.result = application(self.environ, self.start_response) File "/usr/lib/python2.5/site-packages/d

Re: Creating new records via models

2009-04-07 Thread Iqbal Abdullah
Thank you Malcolm! If that's the case then I'll streamlime everything to use save() instead of going through the Manager, as I personally prefer explicit than implicit. Now I too, can sleep at night :) On Apr 8, 12:13 pm, Malcolm Tredinnick wrote: > On Tue, 2009-04-07 at 20:10

Creating new records via models

2009-04-07 Thread Iqbal Abdullah
Hi guys, I'm a bit confused on inserting new data into the db via the models, i.e in the docs http://docs.djangoproject.com/en/dev/topics/db/queries/#topics-db-queries a given example to add new data into a table is: from mysite.blog.models import Blog b = Blog(name='Beatles Blog', tagline='All

Re: Sessions being written twice?

2009-01-21 Thread Iqbal Abdullah
009-01-21 at 04:11 -0800, Iqbal Abdullah wrote: > > Hi guys, > > > I need to support some browsers which doesn't handle cookies, so I > > have followed the snippet here to manually get session ids from the > > request: > >http://www.djangosnippets.org/snippets

Sessions being written twice?

2009-01-21 Thread Iqbal Abdullah
Hi guys, I need to support some browsers which doesn't handle cookies, so I have followed the snippet here to manually get session ids from the request: http://www.djangosnippets.org/snippets/460/ and positioned the new middleware before the SessionMiddleware in the settings.py file. I did an e

Re: Deleting m2m relationship without deleting the data

2009-01-20 Thread Iqbal Abdullah
Hi Malcolm, Thanks for the tip! It works like I wanted it to. Thanks! On Jan 20, 4:44 pm, Malcolm Tredinnick wrote: > On Mon, 2009-01-19 at 22:38 -0800, I.A wrote: > > Hi guys, > > I apologize for the confusing title. > > > I'm still confused on using the models in a m2m relationship. Suppose