Thanks for the reply Ian. I seem to have solved this for the most part. The second message in that thread was very helpful. I was able to use that solution almost exactly. I added the following save() method to my model:
def save(self): if self.image: import shutil from os import path from django.conf import settings pathname, filename = path.split(self.image) new_image = path.join(pathname, '%s-%s' % (str(self.gallery_id), filename)) new_location = path.join(settings.MEDIA_ROOT, new_image) old_location = path.join(settings.MEDIA_ROOT, self.image) if new_location != old_location: shutil.move(old_location, new_location) self.image = new_image print self.image super(Image, self).save() I decided to add the gallery_id to the image filename rather than as a subfolder. It still prevents duplicate filenames -- which is what I wanted -- but it is more simple. However, when I call the save() function, it chokes on the last line: >>> from django.models.gallery import galleries, images >>> i = images.get_object(pk=1) >>> i.image 'gallery/audi-01.jpg' >>> i.save() gallery/1-audi-01.jpg Traceback (most recent call last): File "<console>", line 1, in ? File "/.../gallery/models/gallery.py", line 44, in save super(Image, self).save() AttributeError: 'super' object has no attribute 'save' Should the super() method work even though I'm not using MR? --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~----------~----~----~----~------~----~------~--~---