In this assignment you have been given a mostly complete Django Project. The frontend for the application has been provided for you. The only things missing are:
- the Models
- the URLs
- the Views
More specifically...
This project represents a coffee store database and has 2 models:
Coffee
Transaction
Coffee
has two fields: name
and an price
.
Transaction
has four fields:
time
: DateTime of the transactionitem
- the coffee purchasedpre_tax
- the price of the coffee purchasedtax
- tax charged on the purchase (7% of price)
""
should take you to a view named"home"
"coffee/<id>/buy"
should take you to a view named"buy_coffee"
"transaction/<id>"
should take you to a view named"transaction_detail"
- The
home
view should render"app/coffee_list.html"
and provide allCoffee
s to the context using the key"coffees"
- The
transaction_detail
view should use the id provided through the path to get the appropriateTransaction
from the database and render the"app/transaction_detail.html"
template with thatTransaction
provided in the context using the keytransaction
- The
buy_coffee
view should (on POST) create a newTransaction
in the database using the coffee identified in the path. It should redirect totransaction_detail
for the newly createdTransaction
.