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 this default=random.random. Any Ideas how I can fix this? thanks.
On Dec 9, 6:00 am, Jeff FW <[EMAIL PROTECTED]> wrote: > 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 of default=random.random in the definition. If it's > somewhere else you're trying to call it, let us know. > > -Jeff > > On Dec 9, 5:32 am, 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 date each time each time you call > > it. If you dont do that, datetime.datetime.now() will give you the > > date to which the server was instantiated instead of current > > datetime. > > > Is there a similar way that I can do this for random so that I can get > > a new number each time I call this instead of the number that it > > created when the server was instantiated? > > > Thanks in advance! --~--~---------~--~----~------------~-------~--~----~ 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 from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---