开发者

django database sync problem

In my web django, I do a query of Models.objects.all() or actually any other models in the views.py. It returns me a [,] value (empty array) - view from logs. However back in the manage.py shell, it is able to retri开发者_如何学Ceve the objects. In mysql database, the data entries are there!

I have no idea how to debug from here, is there a way to resolve this error? This is not my first time. I have been doing django project for several months already. Only today, it is giving me this problem.

EDIT : This problem is very weird, I'm just curious whether anybody has encountered this problem before, I'm using Eclipse to edit the scripts(views.py, models.py etc).


Do you have __repr__ defined for your objects? Take a look at the HTML source generated by Django -- there's a good chance it looks like:

[<Model: model object>, <Model: model object>, ...]

Your web browser then interprets the <...> as an HTML tag that it doesn't understand, and thus can't render, and displays only the content outside the tags (the "[", ",", and "]" characters).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜