Re: Get datetime now, not at server initialisation

2020-11-01 Thread Clive Bruton
On 30 Oct 2020, at 11:00, Carles Pina i Estany wrote: Let me know if it's not clear or if I explained something that you didn't ask! Thanks you very much for spending the time on this, to explain it to me - it was very helpful! -- Clive -- You received this message because you are

Re: Get datetime now, not at server initialisation

2020-10-30 Thread Carles Pina i Estany
Hi Clive, On Oct/28/2020, Clive Bruton wrote: > Thanks, that was very helpful. I had another pointer on this and found out > that the easiest way to do this is just to change the ```file``` line in the > class to: > > ``` > file = ImageField(_('image'),

Re: Get datetime now, not at server initialisation

2020-10-28 Thread Clive Bruton
Thanks, that was very helpful. I had another pointer on this and found out that the easiest way to do this is just to change the ```file``` line in the class to: ``` file = ImageField(_('image'), upload_to='images/items/%Y/%m/%d/% H/%M/%S') There are a few things that I do not

Re: Get datetime now, not at server initialisation

2020-10-28 Thread Carles Pina i Estany
Hi, On Oct/27/2020, Clive Bruton wrote: > I have a function that uses the current date to set up a file path for > uploaded images: > > > > def upload_path(): [...] > class Image(models.Model): > item = models.ForeignKey(Item, on_delete=models.CASCADE) >

Get datetime now, not at server initialisation

2020-10-27 Thread Clive Bruton
I have a function that uses the current date to set up a file path for uploaded images: def upload_path(): dtnow = datetime.now(timezone.utc) dtstr = '{:%Y/%m/%d/%H/%M/%S}'.format(dtnow) print('dtstr: ') print(dtstr) dtstr =