4
I am importing a set of preexisting files to Django, and would like to refer them to my templates (which they use FileField or ImageField). For example, one of my models is like this:
class Imagem(models.Model):
    arquivo = ImageField(upload_to=u"img/%Y/%m/%d")
    miniatura = ImageField(upload_to=u"img/thumb/%Y/%m/%d")
    ...
And I have several images (already copied to my MEDIA_ROOT) thus:
MEDIA_ROOT
|- gallery
   |-album1
     |-foto1.jpg
     |-foto2.jpg
     |-...
     |-thumbs
       |-thumbs_foto1.jpg
       |-thumbs_foto2.jpg
       |-...
(Note that the images are not under the folder upload_to, but in a completely different)
Is it possible to create instances of this model by referencing the preexisting images, without having to make copies of them and without having to rename and/or move them? And how would be the command to create these instances?
I have no problems navigating the file system, finding the names of the images and associating each image with its thumbnail, my problem is how to create the template itself:
path_imagem = os.path.join(settings.MEDIA_ROOT, 'gallery/album1/foto1.jpg')
path_miniatura = os.path.join(settings.MEDIA_ROOT, 'gallery/album1/thumbs/thumbs_foto1.jpg')
Imagem.objects.create(???)
Examples in the Django documentation (e.g..: FileField, "File Uploads", "Managing Files") are all related to new files, where one creates a File or if you get one from an upload, for example. In my case the files already exist and are already under the MEDIA_ROOT.