Week 2: Creating Basic Web App
Hi everyone! This week, I decided to start building the web app in Python Django:
To create a basic user registration, I called Django’s built-in user creation form. After creating a “successful registration” condition, I wrote two methods to help with the registration process: form_valid and get.
The form_valid method ensures that all the criteria for creating a profile are met: username is <150 characters and letters, digits and @/./+/-/_ only, the password is greater than 8 characters, and it matches with a verification one. The get method redirects the users to their personalized home page if the successful registration condition is met.
Basic home page:
The home page has four main components: a logout button, a search function, an “add ingredient” button, and a view ingredient area.
The logout button allows users to log out while saving all their information. The search bar traverses through the uploaded ingredients database and looks for the search input’s letters.
The add ingredient button allows users to upload the ingredients that they want to donate. If they click this button, they will be redirected to a form where they can input the name of the ingredient, the quantity, and a brief description of the product. Once they upload, the new ingredient will be visible to all users and only the creator will have the option to delete the ingredient.
Thank you for reading!