Using Flask-Admin with Mongoengine, I am stuck when trying to customize model view for the list of submitted posts. The idea is to add a cell to each post (corresponding to a row in the list) in order to show the number of comments submitted on each post.
I have added the following get method to the class:
class PostView(ModelView):
def get(self):
posts = Post.objects.all()
return render_template('admin/model/list.html', posts=posts)
The list.html contains the following:
<td>
{% for d in posts %}
{% with total=d.comments | length %}
{{ total }}
{% endwith %}
{% endfor %}
<td>
The table cells stay empty. What should I do instead ? Thanks in advance !