Introduction to Tornado by Brendan Berg Allison Parrish Michael Dory
Author:Brendan Berg, Allison Parrish, Michael Dory [Brendan Berg, Allison Parrish, Michael Dory]
Language: eng
Format: epub
Publisher: O'Reilly Media, Inc.
Published: 2018-10-03T00:00:00+00:00
{% extends "main.html" %} {% autoescape None %} {% block body %} <form method="POST"> ISBN <input type="text" name="isbn" value="{{ book.get('isbn', '') }}"><br> Title <input type="text" name="title" value="{{ book.get('title', '') }}"><br> Subtitle <input type="text" name="subtitle" value="{{ book.get('subtitle', '') }}"><br> Image <input type="text" name="image" value="{{ book.get('image', '') }}"><br> Author <input type="text" name="author" value="{{ book.get('author', '') }}"><br> Date released <input type="text" name="date_released" value="{{ book.get('date_released', '') }}"><br> Description<br> <textarea name="description" rows="5" cols="40">{% raw book.get('description', '')%}</textarea><br> <input type="submit" value="Save"> </form> {% end %}
This is a fairly conventional HTML form. We’re using the book dictionary passed in from the request handler to prepopulate the form with data from the existing book, if any; we use the Python dictionary object’s get method to supply a default value for a key if the key isn’t present in the dictionary. Note that the name attributes of the input tags are set to the corresponding key of the book dictionary; this will make it easy to associate the data from the form with the data we want to put into the database.
Also note that, because the form tag lacks an action attribute, the form’s POST will be directed to the current URL, which is precisely what we want (e.g., if the page was loaded as /edit/0-123-456, the POST request will go to /edit/0-123-456; if the page was loaded as /add, the POST will go to /add). Figure 4-1 shows what the page looks like when rendered.
Download
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
Deep Learning with Python by François Chollet(11975)
Hello! Python by Anthony Briggs(9423)
OCA Java SE 8 Programmer I Certification Guide by Mala Gupta(9388)
The Mikado Method by Ola Ellnestam Daniel Brolund(9352)
Dependency Injection in .NET by Mark Seemann(8896)
Algorithms of the Intelligent Web by Haralambos Marmanis;Dmitry Babenko(7895)
Test-Driven iOS Development with Swift 4 by Dominik Hauser(7413)
Grails in Action by Glen Smith Peter Ledbrook(7332)
The Well-Grounded Java Developer by Benjamin J. Evans Martijn Verburg(7161)
Secrets of the JavaScript Ninja by John Resig Bear Bibeault(6006)
Kotlin in Action by Dmitry Jemerov(4683)
Practical Vim (for Kathryn Amaral) by Drew Neil(3746)
Cracking the GRE Premium Edition with 6 Practice Tests, 2015 (Graduate School Test Preparation) by Princeton Review(3625)
Linux Device Driver Development Cookbook by Rodolfo Giometti(3532)
Learn Windows PowerShell in a Month of Lunches by Don Jones(3277)
Becoming a Dynamics 365 Finance and Supply Chain Solution Architect by Brent Dawson(3188)
Microservices with Go by Alexander Shuiskov(2973)
Practical Design Patterns for Java Developers by Miroslav Wengner(2891)
Learning Java by Patrick Niemeyer & Daniel Leuck(2890)