[pyar] [django] campo id en base de datos legacy

Angel Freire cuerty en gmail.com
Jue Oct 21 11:31:57 ART 2010


2010/10/21 Juanjo Conti <jjconti en gmail.com>:
> 2010/10/21 Gustavo Campanelli <gedece en gmail.com>:
>> ¿Para que renumerar a mano cuando tenes Python para renumerar
>> automáticamente?
>
> No digo "reenumerar" sino "agregar las columnas".
>
> Por supuesto, cuando digo a mano, estoy pensando en un programa :D
>
> --
> Juanjo Conti
> blog: http://www.juanjoconti.com.ar
> _______________________________________________
> 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/
>

Juanjo:

¿esas tablas tienen primary key?

Si tienen pero no es un entero no hay problema, solamente agregale
"primaryKey=True" a los atributos del campo que corresponda.
Si tienen pero es compuesto por varios campos, te recomiendo leer
http://code.djangoproject.com/wiki/MultipleColumnPrimaryKeys
Si no tiene primary key, no vas a poder realizar modificaciones,
aunque para ver la tabla podes usar el "hack" comentado aca:
http://stackoverflow.com/questions/605896/django-querying-read-only-view-with-no-primary-key

Saludos,
Angel



-- 
http://blog.cuerty.com

"If you want to set off and go develop some grand new thing, you don't
need millions of dollars of capitalization. You need enough pizza and
Diet Coke to stick in your refrigerator, a cheap PC to work on and the
dedication to go through with it."
- John Carmack



More information about the pyar mailing list