Hi,
I'd like to save my images using this schema (which is, I think,
something 99% of web sites do):

def upload_to(instance, filename):
   return "photos/%s/%s"%(instance.pk % 1000, filename)

the problem is that, as mentioned in the documentation about the
"instance" parameter of upload_to:

"In most cases, this object will not have been saved to the database
yet, so if it uses the default AutoField, it might not yet have a
value for its primary key field."

So I have two questions:

- Is there a workaround to obtain my desired behaviour?
- Why the model isn't saved to the db before calling upload_to?

--~--~---------~--~----~------------~-------~--~----~
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