Project 3:

Project Specification: Finish building the Budget App. Build a form that allows users to add new entries. Create a donut and bar chart to show the total amounts for each transaction type. Also, allow the user to delete existing entries. Style the budget app using django-bootstrap5. Finally, add a “jumbotron” style to the application home page.

  • Make a copy of your Project2-Django folder and name the folder Project3-Django.
  • Navigate to the directory that contains manage.py and open the folder in VS code.

  1. (30 points) Start by creating a form that handles GET and POST requests that allow users to add new entries.

    • a. To do so, create your first form in the file forms.py.
      • i. Import the model we need to work with, Entry.
      • ii. Define the class called EntryForm, which inherits from forms.ModelForm. Within the nested Meta class, build the form from the Entry model and include the following fields: merchant, description and transaction_amount. Make sure the labels are displayed for each field.
    • b. Append the urls.py file (budget_app\urls.py) to add an additional URL pattern for the new_entry page. This pattern should send requests to the view function new_entry().
    • c. Define a new view function, new_entry(), to handle GET and POST requests for the entry form in the views.py file. In the file, make sure to import EntryForm.
    • d. Create a new template called new_entry.html to display the form. Ensure that the template extends base.html. Next, edit the transaction template (transaction.html) by adding a hyperlink to the new_entry page.
  2. (30 points) Create a donut and bar chart to show the total amounts for each transaction type.

    • a. Append the urls.py file (budget_app\urls.py) to add an additional URL pattern for displaying the two charts. This pattern should send requests to the view function, visuals().
    • b. Define a new view function named visuals(). This function should reference the Entry class and use a list comprehension to construct a list of tuples containing each transaction type and its corresponding transaction amount. Then, using plotly express and pandas, create a donut and bar chart chart showing the total transaction amounts by transaction type.
    • c. Create a new template called visuals.html to display both charts inside a table. Style the table using Bootswatch’s Minty theme by applying the table table-hover style to the < table> element. Ensure that the template extends base.html.
    • d. Then, modify the base.html file by adding a hyperlink to the visuals page on the navigation bar.
  3. (20 points) Allow users to delete existing entries.

    • a. Append the urls.py file (budget_app\urls.py) to add an additional URL pattern for deleting an entry. This pattern should send requests to the view function, delete_entry().
    • b. Define a new view function named delete_entry(). This function should get a request and the entry_id and then return a redirect to the transaction URL pattern using the reverse function.
    • c. Next, edit the transaction template (transaction.html) to include a hyperlink, allowing the user to delete an entry of their choosing.
  4. (20 points) Style the base.html and index.html pages using django-bootstrap5:

    • a. Add django_bootstrap5 to the settings.py file and save the bootstrap.css file in the static folder.
    • b. Follow the steps listed in the “Applying Bootstrap” & “Bootswatch Themes” course notebook pages to modify the base.html file. Load the Bootstrap styles, style the navigation bar using the Minty theme from Bootswatch, and add the page header template tags.
    • c. Add the jumbotron element to index.html titled, “Pythonic Purse”.

  • Generative artificial intelligence tools (ChatGPT, Claude, Copilot, etc.) are not allowed to be used on projects. The project code should directly reflect and relate to the material covered in our course notebook.
  • Submission Instructions: The project will be due on Wednesday, December 2 by 11:59p. Zip/Compress the project folder and submit to Canvas.

The index home page Browser window displaying the Budget App home page at 127.0.0.1:8000. A mint green navigation bar across the top shows Budget App, Transactions, and Track Your Spending. In the center, a large light gray jumbotron-style card displays the text Pythonic Purse, A Python budget application, and Intelligent Budgeting, Python-Powered. Below the card, body text reads This Budget App will help you achieve the goals you are working toward. Hopefully it will give you an action plan of where your money is going. The wider environment is a simple web app layout with generous white space and a clean, calm, welcoming tone.


The transactions page Browser window showing the Budget App transactions page. The primary subject is a transaction listing table where the user can review budget entries. The page appears to include navigation at the top consistent with the app, with Transactions emphasized as the active workflow. The wider environment is a classroom project web interface focused on tracking spending, with a practical, task-oriented tone.


The transaction page Browser window displaying a single transaction-focused Budget App page where the user is working with transaction details and related actions. The main subject is transaction management within the app workflow, likely showing entry information and controls connected to editing or deleting records. The wider environment is a straightforward browser-based budget tool with a neutral, productivity-focused tone.


The new_entry page Browser window showing the Budget App new entry page. The primary subject is a form the user fills out to add a transaction, with fields for merchant, description, and transaction amount, plus a submit action to save the entry. The wider environment is a simple Django page styled for usability, conveying a focused and instructional tone for data entry.


The visuals page Browser window displaying the Budget App visuals page. The main subjects are two charts, a donut chart and a bar chart, summarizing total transaction amounts by transaction type so the user can compare spending categories at a glance. The charts are presented within a styled page layout associated with the app navigation. The wider environment is an analytics-style dashboard view with a clear, informative, and data-focused tone.