Re: Using random.random() while running on server

2008-12-10 Thread bruno desthuilliers
On 9 déc, 23:56, Chris <[EMAIL PROTECTED]> wrote: > Thanks Daniel Roseman That did the trick. I did not think to do a > lambda > > > I _very_ strongly suggest you take some time learning Python. In this > > case, the parens are actually the call operator. Not applying this > > operator results

Re: Using random.random() while running on server

2008-12-09 Thread Chris
Thanks Daniel Roseman That did the trick. I did not think to do a lambda > I _very_ strongly suggest you take some time learning Python. In this > case, the parens are actually the call operator. Not applying this > operator results in getting a reference to the function (or whatever >

Re: Using random.random() while running on server

2008-12-09 Thread Jeff FW
Also, as an aside to all of that--what you're generating is in no way guaranteed to be unique. If you really need a unique string, use a UUID or hash of the primary key. On Dec 9, 3:48 pm, bruno desthuilliers <[EMAIL PROTECTED]> wrote: > On 9 déc, 11:32, Chris <[EMAIL PROTECTED]> wrote: > > >

Re: Using random.random() while running on server

2008-12-09 Thread bruno desthuilliers
On 9 déc, 11:32, Chris <[EMAIL PROTECTED]> wrote: > Hello, > when django is running on a server, I want to make a call to: > random.random(). When I make a call to this again, I can't. I think > this related to a similar issue datetime.datetime.now() where you > leave off the () to get a current

Re: Using random.random() while running on server

2008-12-09 Thread Daniel Roseman
On Dec 9, 7:34 pm, Chris <[EMAIL PROTECTED]> wrote: > Here is a code snippet:http://dpaste.com/97475/so basically when I > login to the backend and try to add a couple rows. I get the same > random id each time. As you might realise, what's happening is that Django is evaluating your call to

Re: Using random.random() while running on server

2008-12-09 Thread Chris
Here is a code snippet: http://dpaste.com/97475/ so basically when I login to the backend and try to add a couple rows. I get the same random id each time. On Dec 9, 10:27 am, Jeff FW <[EMAIL PROTECTED]> wrote: > Can you show me exactly what you're trying to do?  That would make it > much easier

Re: Using random.random() while running on server

2008-12-09 Thread Jeff FW
Can you show me exactly what you're trying to do? That would make it much easier to help you. -Jeff On Dec 9, 1:19 pm, Chris <[EMAIL PROTECTED]> wrote: > I found this snippet:http://www.djangosnippets.org/snippets/814/and > noticed that it does not work as intended do to the issue that I >

Re: Using random.random() while running on server

2008-12-09 Thread Chris
I found this snippet: http://www.djangosnippets.org/snippets/814/ and noticed that it does not work as intended do to the issue that I described. I tried passing it as default instead of using the save method but does not work and since I am not passing random to default directly, I cannot do

Re: Using random.random() while running on server

2008-12-09 Thread Jeff FW
Chris, It depends on where you're calling random.random(). If you're trying to do it in a model definition, then you're always going to have the value it chose when it first executed the model's class definition-- when the server starts up. In that case, you should be able to pass an argument

Using random.random() while running on server

2008-12-09 Thread Chris
Hello, when django is running on a server, I want to make a call to: random.random(). When I make a call to this again, I can't. I think this related to a similar issue datetime.datetime.now() where you leave off the () to get a current date each time each time you call it. If you dont do that,