[pyar] [django] [Admin] Ayuda para resolver un problema. Metodo Save

Juan Gabardini jgabardini en gmail.com
Lun Mayo 9 22:56:31 ART 2011


2011/5/9 Daniel <dmlistapython en gmail.com>

> Me contesto solo por si alguien le sirve.
> pude "saber" si vienen los archivos de imágenes
> utlizando:
>         form.files.has_key("tapa")     (1)
>
> has_key(*key*)¶<http://docs.python.org/library/stdtypes.html#dict.has_key>Test
for the presence of *key* in the dictionary.
has_key()<http://docs.python.org/library/stdtypes.html#dict.has_key>
is
deprecated in favor of key in d.http://docs.python.org/library/stdtypes.html

(me enteré hoy :P)



> Claro, sólo me sirve para cuando mandan un archivo, aún me queda
> averiguar como saber
> qué dato modifican de un form... pero algo es algo
>
>     def save_model(self, request, obj, form, change):
> (1)    if form.files.has_key("tapa")
>             obj.tapa.name=obj.isbn + "_T_" + obj.autor+".jpg"
>         return super(LibroAdmin, self).save_model(request, obj, form,
> change)
>
>
>
>
> --
> Daniel Malisani
> _______________________________________________
> pyar mailing list pyar en python.org.ar
> http://listas.python.org.ar/listinfo/pyar
>
> PyAr - Python Argentina - Sitio web: http://www.python.org.ar/
>



-- 
Juan Gabardini
twitter&skype:jgabardini | http://softwareagil.blogspot.com
------------ próxima parte ------------
Se ha borrado un adjunto en formato HTML...
URL: <http://listas.python.org.ar/pipermail/pyar/attachments/20110509/e8def774/attachment.html>


More information about the pyar mailing list