jeudi 4 juin 2015

Django doesn't add me content into sqlite db

im parsing an XML doc, adding into sqlite db and same time printing it in console. I've different fields. For example, I've in my db, TITULO, charField(max_length=100).

models.py

from django.db import models

class Actividad(models.Model):
    id_evento = models.FloatField()
    titulo = models.CharField(max_length=100)
    tipo = models.CharField(max_length=100)

TITUTO field works OK ..

    elif self.TITULO:
        self.Evento.titulo = content

now, do the same with another field called TIPO

    elif self.TIPO:
        self.Evento.tipo = content

does nothing! It is printed in console, but not added into sqlite db, same field charField(max_length=100), there is no msg error!

Im doing print(content) and can see it in the screen, but no in the sqlite db! I mean, I can see the content printed in the screen, but it doesn't update in the db and there is TIPO blank field.

(At least I do self.Evento.save())

Aucun commentaire:

Enregistrer un commentaire