Open rochacbruno opened 11 years ago
The fields_order
parameter was removed, use fields
instead.
I changed it to fields
fields = ['title', 'slug', 'channel', 'channels', 'summary',
'body', 'published', 'comments']
But now I got an error.
I've found the problem.
When I define
fields = ['title', 'slug', 'channel', 'channels', 'summary', 'body', 'published']
It works well.
But, if I include the EmbeddedDocumment it faills and raises that error.
fields = ['title', 'slug', 'channel', 'channels', 'summary', 'body', 'published',
'comments']
In the above case I included comments in the list field.
class Comment(db.EmbeddedDocument, Publishable):
body = db.StringField(verbose_name="Comment", required=True)
author = db.StringField(verbose_name="Name", max_length=255, required=True)
published = db.BooleanField(default=True)
def __unicode__(self):
return "{}-{}...".format(self.author, self.body[:10])
meta = {
'indexes': ['-created_at'],
'ordering': ['-created_at']
}
#And int he Post class
comments = db.ListField(db.EmbeddedDocumentField(Comment))
The problem, I guess is that it is looking for all the defined fields in the embedded document itself.
So there is a problem when using EmbeddedDocuments and fields argument.
@rochacbruno Can you tell me which Rich Text Editor
you used in 'Edit Post' page ?
THX !
I have this issue too. Searched for the answer, found this post, but no answer. What's the fix? Because I want to order the fields AND include the EmbeddedDocument.
Hi, it was working a week ago but now is broken.
I defined: https://github.com/rochacbruno/quokka/blob/master/quokka/modules/posts/admin.py#L35
And admin rendered in the model defined order.