![]() This input.html file is passed as the argument value in render_template in the last line of the route. In Jinja for loop OPTION is created using the name as the display value and id as the value part visible to the user when she clicks on the drop down. This name is referred when POST method returns the form data filled by a user. This loop is preceded by the SELECT HTML tag with name of SELECT dropdown. This is done in input.html which must be saved in the templates folder of your application folder. The last step will fill the data in the dropdown or combo using Jinja for loop. Return render_template("input.html",joblist=joblist ) Step 6- Fill the dropdown using Jinja for #render template and send the set of tuples to the HTML file for displaying #fetch all rows ans store as a set of tuples #execute select statement to fetch data to be displayed in combo/dropdownĬursor.execute('SELECT JobID,JobName FROM jobs') Type and run the following command to install Flask index(): Switch to the command window and Press CTRL+C to exit Flask application prompt. Now your application is running as explained in step 2. Next is to create a Flask Web Application using the steps described in the post – Create Python Website- Get Started with Flask. INSERT into jobs (JobID, JobName, Salary, Commission) values (5, 'General Manager',4000,1) Step 2- Create Flask Web Application and a Template ![]() INSERT into jobs (JobID, JobName, Salary, Commission) values (4, 'Prod Manager',4000,0) INSERT into jobs (JobID, JobName, Salary, Commission) values (3, 'HR Manager',4000,0) INSERT into jobs (JobID, JobName, Salary, Commission) values (2, 'Sales Officer',3000,5) INSERT into jobs (JobID, JobName, Salary, Commission) values (1, 'Sales Manager',4000,5)
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |