Home - Ambiguous-Squids/Bangazon_initial_site GitHub Wiki

Building the First Version of the Bangazon Site

Learning Objectives

Requirements

You will be building a Django application that will be the first, stable version of the Bangazon Platform product site.

Models

  1. Products will be created by customers, so make sure that you have a column on the Product model to store which customer created it.
  2. Add a new model named ProductType. Add a foreign key to ProductType in the Product model. It must be non-nullable, which means that you will likely need to provide a default value for your migration to work. The only fields needed are the primary key, and Label.
  3. Add a model named PaymentType.
  4. A Customer can have many payment types.
  5. The Order model must have a foreign key field to the PaymentType model, but it can be nullable. However, before an order can be completed, there must be a value for the PaymentType field.

Generated Application

Make sure you produce a layout with your index.html Django template for the application so that the structure of each page is consistent.

  1. User registration and login.
  2. Product creation form for user to sell a product.
  3. List of all product types.
  4. Provide a view to show all products that are of a particular product type.
  5. List all products, with the name text as a hyperlink to the detail view.
  6. Provide a product detail view.
  7. List payment types for current customer.
  8. On the product detail view, have an Add to Order button that, when clicked, either creates a new order for a customer that doesn't have an active one, or adds to an existing open order.
  9. In the navigation bar, have an affordance that shows the current customer how many items are in their order.
  10. If the user clicks on their order in the navigation bar, take them to the order detail view, which lists products, their prices, and current total for order.
  11. On the order detail view, have a button labeled Complete Order.
  12. When a customer starts to complete an order, show them a list of payment types that are assigned to them. When they select one to add to the order, then the order is complete.

Resources

Django Models and Migrations

Using the requirements above create a model for each resource, and use migrations to ensure your database structure is up to date.

Templates

Django template language

Form Helpers

Django, like Angular, has many built-in helper tags and filters when building the site templates. We strongly recommend reading this documentation while building your templates.