Hi Wegen.
carimage = models.ImageField(upload_to = 'images/cars/%s.png' % carID,
null = True, blank = True)
this won't work. upload_to must be a string (it's not evaluated at the
time the object is saved to the database).
your best bet is to leave the path to the desired directory and name
the file on save. something like this:
carimage = models.ImageField(upload_to = 'images/cars/",null = True,
blank = True)
def save(self):
if self.id is not None and len(self.carimage) >1:
self.carimage = %s.png' % self.id
super(ModelName, self).save()
** the if check is a workaround a bug (ticket # 639) where save passes
two times for file fields.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django developers" 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-developers
-~----------~----~----~----~------~----~------~--~---