Django EmbeddedDocument

3 views
Skip to first unread message

Hélio Miranda

unread,
May 17, 2013, 6:01:49 AM5/17/13
to django...@googlegroups.com
Oi.

Estou a tentar fazer um test com EmbeddedDocument assim:
class Post(Document):
    title = StringField(max_length=60)
    body = StringField()
    comments = ListField(EmbeddedDocumentField('Comment'))

pp = Post(title='ola',body='aa')
pp.save()
    
class Comment(EmbeddedDocument):
    author = StringField(max_length=60)
    body = StringField()
    
cc = Comment(author='eu',body='oo')
cc.save()

Mas está a dar o seguinte erro: 'Comment' object has no attribute 'save'
O que estou a fazer mal?

Hélio Miranda

unread,
May 17, 2013, 6:28:28 AM5/17/13
to django...@googlegroups.com
Já consegui resolver pessoal.
Obrigado na mesma :)
Reply all
Reply to author
Forward
0 new messages