The "TopLevelDocumentMetaclass" object is not iterable

I am very new to the django world and I am trying to make an example to use it with mongodb. To connect to mongo, I use mongoengine 0.9.0. I also use virtualenv.

Right now I have some pretty simple things, I can start the server, but when I try to render a web page, I get this error:

'TopLevelDocumentMetaclass' object is not iterable.

I checked the records of others with a similar “object that is not iterable”, but most of them were with user models.py models, mine was on .py sites, and at the moment I prefer not to change it until I know that I doing: S

Here are my installation packages:

  • Django == 1.5.1
  • Django Shortcuts == 1.5
  • djangotoolbox == 1.8.0
  • mongoengine == 0.9.0
  • PyMongo == 2.5.2

My models.py looks like this:

from mongoengine import *
from mongoengine import connect
connect('mydatabase')

class Restaurant(Document):
    name = StringField(max_length=200) 

, views.py,

def admin(request):
    html = "<html><body>Proyecto de ejemplo</body></html>"
    return HttpResponse(html)

mongoengine Model.py, django.db, , , mongoengine.

- , ?

+4

All Articles