In a model, I have a field (ImageField) where I need to "manually" set an already existing file which is also already stored in my upload directory.
My problem is that the only way to set this field correctly is by moving the file to a temporary place, as the save() method wants to create the file which erases my previous file. Here's what's not working when 'the_filename' is already in my upload directory: preview = models.ImageField(upload_to="uploads") myimagefile = open(the_filename,'r') content = ImageFile(myimagefile) preview.save(the_filename, content, save=True) content.close() myimagefile.close() If I understand correctly, preview.save() writes content to a supposedly new file, which is problematic as I already have it. Is there a way to tell Django that I just want my 'preview' field to point to the_filename without using 'preview.save' ? Thanks, Lior --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---