python - Can save django model to mysql database, but ORM is broken -
i have following model
class examtimeslot(models.model): course = models.foreignkey(course) start_time = models.datetimefield()
and test project under python's interactive mode through
python manage.py shell
i can save insance of model through
>>> s = datetime.datetime(2014,4,4,12,30,0,0,django.utils.timezone.utc) >>> ex = examtimeslot(course=c, start_time=s) >>> ex.save()
and when check mysql database, data saved
mysql> select * sm_examtimeslot; +----+-----------+---------------------+ | id | course_id | start_time | +----+-----------+---------------------+ | 1 | 1 | 2014-04-04 12:30:00 | +----+-----------+---------------------+ 1 row in set (0.00 sec)
but when query shell through, nothing returned
>>> examtimeslot.objects.all() []
can me this? thanks!
Comments
Post a Comment