Hello,

I'm new to Django, and I have a question.
I have a ImageField() in my model, and I obviously want that each image has 
a unique name in my filesystem. How to do this?
My idea was to include the timestamp in the name of the image (I'll never 
have more than one image uploaded per second). So I coded something like 
this for the name of the uploaded image:
     f, ext = os.path.splitext(filename)
     return "images/%d%s" % (datetime.now(), ext)

But I get an error: "%d format: a number is required, not datetime.datetime"

So my question is: how to get the timestamp of the current time as an 
integer? 
Thanks for your help!

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to