Sample Form to Insert a Professional

Purpose:

Project Part 4 requires you to create admin pages where the user can add professionals, service categories, and services. Taking user data and acting on it requires several steps. Your job is to practice and understand each step. This exercise provides you a sample "add professional" page, patterned after your project. It uses a single form to add a professional. You are to test it, change it, understand it, and learn from it, so you can apply the principles to the more complicated "add services" page (which displays multiple forms, one allowing you to add a service category and also allows you to add a service into each category).

Download the Sample Code

This limited demo code functions the way your professionals_add page should. It deliberately isolates the part of the project that does this, stripping out most other functionality. The data_restore route works so you can reset the data easily. Unzip it and run it using the Flask dev server. Go to the professionals_add route. The Flask app responds with a page that lists professionals and displays a form to take user data for a new one. The form submits to the professionals_add route (POST request with data). The back end receives the data, validates it, takes back end actions (file and database), and then re-renders the page.

Deep Dive: Walk Through the Execution Stage by Stage

Take the following steps to help you understand each stage of execution before you may mark this exercise as done.

Stage 1: Form Page (GET Request).

Stage 2: Invalid Form Submission with NoValidate (POST Request).

Stage 3: Valid Form Submission (POST Request).