here, i have a function that used as a upload_to parameter in my
model. But i records my pic as screenshot_None.gif. Becouse id is
appearing when it is recorded. How can i record my images as
screenshot_id.gif ?? thanks for your response

from os.path import join, exists
from os import remove

def screenshot_path(instance = None, filename = None):
    filepath = join("products",  "images", instance.product.type,
instance.product.slug, "screenshot_" + str(instance.id) + ".gif")
    if exists(join(MEDIA_ROOT,filepath)):
        remove(join(MEDIA_ROOT, filepath))
    return filepath

--~--~---------~--~----~------------~-------~--~----~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to