Let's say I have this handler:
class MainHandler(tornado.web.RequestHandler):
def get(self):
users = models.Users.objects()
self.render(
"index.html",
page_title='My Webpage',
page_heading='Welcome to my Page',
users = users
)
Users model could be:
class User(Document):
firstName = StringField()
lastName = StringField()
title = StringField()
email = StringField()
phone = StringField()
org = StringField()
And then in index.html:
{% extends "main.html" %}
{% autoescape None %}
{% block body %}
<h1>{{ page_heading }}</h1>
<h2>All the User's first names:</h2>
{% for user in users %}
<p>{{ user.firstName }}</p>
{% end %}
{% end %}
What happens to the rest of the info in the Document for users
? Does it get sent to the client anyway?
No, why should it be? The only thing sent to the client is the rendered HTML. If you do not include some data in that HTML, it doesn't get sent anywhere.