Book Image

Python for Google App Engine

By : Massimiliano Pippi
Book Image

Python for Google App Engine

By: Massimiliano Pippi

Overview of this book

Table of Contents (15 chapters)
Python for Google App Engine
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Handling forms


The main page of the application is supposed to list all the notes that belong to the current user but there isn't any way to create such notes at the moment. We need to display a web form on the main page so that users can submit details and create a note.

To display a form to collect data and create notes, we put the following HTML code right below the username and the logout link in the main.html template file:

{% if note_title %}
<p>Title: {{note_title}}</p>
<p>Content: {{note_content}}</p>
{% endif %}

<h4>Add a new note</h4>
<form action="" method="post">
  <div class="form-group">
    <label for="title">Title:</label>
    <input type="text" id="title" name="title" />
  </div>
  <div class="form-group">
      <label for="content">Content:</label>
      <textarea id="content" name="content"></textarea>
  </div>
  <div class="form-group">
      <button type...