Why use a timer, what about storing time in a "taken_time" column in your model, then subtract expiration time from current and check if this number is grater than the "Taken time" timestamp
In the view the gets ready to render a browsable object, just do the same time difference hickamajig as above and determine if the item is available before rendering it to the template? I think you can also do the math in the template... my preference is to keep as much logic as possible out of the presentation layer. On Dec 3, 2009, at 3:24 PM, Mark wrote: > Hi, > > I'm using Django to create registration/payment application for a > limited number of products. I want to create a timer so that when a > user chooses to purchase a product, that product will then displayed > as "already taken". But, if the user the user does not go through > with the purchase and the timer runs out, the product goes back to > status "available". If the user completes the purchase, the timer > should cancel, leaving the product's status permanently as "already > taken". > > I've tried using python's dictionary to instantiate python Timer > objects of the fly, but about 30% of the time, I get a "key error" > when it's time to cancel the Timer. > > Please. Could someone give me an idea on the proper way to do this in > Django? > > Thanks very much! > 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-us...@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 > . > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@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.