![]() |
In this article, we will guide you through creating a Recipe Print GUI. To achieve this, we first establish a login system, allowing sellers to create accounts through registration and subsequent login. Once logged in, we provide a straightforward form where sellers input the name, price, and quantity of materials. After clicking the “Add” button, the system calculates the total by multiplying the price and quantity, and the sum is displayed in a table at the bottom. Sellers can conveniently manage their data by accessing options to delete or update entries with a single click. When ready, they can generate bills effortlessly by clicking the “Generate Bill” button. Finally, sellers can log out with a simple click on the “Logout” button. Receipt Print with GUI using DjangoSellers can conveniently manage their data by accessing options to delete or update entries with a single click. When ready, they can generate bills effortlessly by clicking the “Generate Bill” button. Finally, sellers can log out with a simple click on the “Logout” button. To install Django follow these steps. Starting the Project FolderTo start the project use this command django-admin startproject core To start the app use this command python manage.py startapp home Now add this app to the ‘settings.py’ INSTALLED_APPS = [ File Structure ![]() file Structure Setting Necessary Filesmodels.py: This Django model defines a Receipt with fields for user association, name, price, quantity, and total. It includes a foreign key to the User model and sets default values for the fields. Python3
views.py: The functions in the view file collectively build a Django web application for managing receipt data, user accounts, and generating PDFs. Python3
Creating GUIlogin.html: This HTML code is for a basic login page within a Bootstrap-styled container. It includes fields for a username and password, a “Login” button, and a link to create a new account. The page uses some custom CSS for styling and includes external libraries for additional styling. HTML
register.html: This HTML code is for a simple registration page. It includes fields for a username and password, a “Register” button, and a link to log in. The page uses Bootstrap and Font Awesome for styling and includes custom CSS for additional styling. HTML
receipt.html: This HTML template extends a base template, and it creates a form for users to add receipts with item details. It also displays a list of existing receipts in a table, allowing users to delete or update them. The page includes styling with Bootstrap and custom CSS for aesthetics and layout. Additionally, there are options to generate a bill and log out. HTML
update_receipt.html: This HTML template is for updating data in a web application. It includes a form for editing details related to an item, with fields pre-filled using existing data. The page uses Bootstrap for styling and some custom CSS. Users can update the data by clicking the “Update Data” button. HTML
pdf.html: This HTML template creates a receipt for a purchase with the following features:
The page offers a printable receipt for users to save or use for their records. HTML
base.html: In this html file we write the code of the table and some basic margin padding which we apply in some html files for that we joint some html file with base.html file HTML
admin.py:Here we are registering our models. Python3
Deployement of the ProjectRun these commands to apply the migrations: python3 manage.py makemigrations Run the server with the help of following command: python3 manage.py runserver
Output ![]() base.html |
Reffered: https://www.geeksforgeeks.org
Django |
Type: | Geek |
Category: | Coding |
Sub Category: | Tutorial |
Uploaded by: | Admin |
Views: | 14 |