Created
May 5, 2018 20:33
-
-
Save dpineiden/c6b8827b94e12405a72be5f2b2214cf9 to your computer and use it in GitHub Desktop.
Django Image saved with scripting
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ruta_img = img_propiedad_tuple[1] | |
with open(os.path.join(path,ruta_img),'r+b') as im: | |
imagen = ImageFile(im) | |
print("Imagen: %s" %imagen) | |
print("Imagen: %s" %type(imagen)) | |
print("Image opened: %"%im) | |
new_img_propiedad.imagen = imagen | |
new_img_propiedad.etiqueta = img_propiedad_tuple[2] | |
new_img_propiedad.principal = img_propiedad_tuple[3] | |
new_img_propiedad.propiedad = Propiedad.objects.get(id = IDs['propiedad'][img_propiedad_tuple[4]]) | |
new_img_propiedad.save() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment