python - MongoEngine schemata - name error -


i have following schema in file called model.py

from mongoengine import *  class subject(document):     uri = stringfield(required=true)     resources = listfield(referencefield(resourcesubject))  class resourcesubject(document):     subject = referencefield(subject,reverse_delete_rule=cascade)     resource = referencefield(resource)  class resource(embeddeddocument):     uri = stringfield()     title = stringfield()     snippet = stringfield()     image = stringfield()     source = stringfield()     adapter = stringfield() 

for reason when try initialize subject, subj = subject(uri="hello").save() getting name error : nameerror: name 'resourcesubject' not defined.

i cant understand reason, guess related framework? tried separating classes in individual files , importing, still same error. missing ?

the error thrown on line: resources = listfield(referencefield(resourcesubject))

put resourcesubject quotes:

resources = listfield(referencefield('resourcesubject')) 

Comments

Popular posts from this blog

google chrome - Developer tools - How to inspect the elements which are added momentarily (by JQuery)? -

angularjs - Showing an empty as first option in select tag -

php - Cloud9 cloud IDE and CakePHP -