Is it possible to change a model's upload_to on a per instance basis?
Essentially, what I'd like to do is this:
class GeneratedFile(models.Model):
source = models.ForeignKey(FileUpload)
generated = models.FileField(upload_to="generated/%d" % self.fileupload_id)
But that of course isn't possible because you can't access 'self' like
that at creation. I will only ever be creating instances of
GeneratedFile programatically (ie. in a view), so the *ideal* solution
would be to change an instance's 'upload_to' in code.
What I want is for each GeneratedFile to be in a different directory,
and other than strftime, I can't find a way to do that.
Jay P.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---