Assignment 2 - Working on Django

GT Movies Store is a web application for an online movie store developed based on the Django. It provides users with a complete experience of browsing, searching, purchasing movies, and writing reviews. The project adopts the MVT (Model-View-Template) architectural pattern.

Process Description

I think I was using an Agile development approach, since there wasn't a fully completed plan before I finished the project, and I implemented it module by module, chapter by chapter in the book. Having prior experience with Express.js and Flask, the MVT pattern was not new to me. However, this was my first time using a framework with built-in ORM support.

Following the book, I first implemented a static home module, then the movies module - initially with dummy data and later with defined models. After that, I completed the rest of the MVT components for the users and cart modules.

I didn't encounter any major questions or doubts during the development, since the process was similar to Flask and I was closely following the book. What impressed me most was Django's built-in administration panel, authentication system, and ORM - all of which need to be implemented manually in Flask. These features made prototyping much more enjoyable, and I appreciated the flexibility of being able to switch database backends easily (I usually use SQLite for development and PostgreSQL for production).

User Story Implementation

Information Display and Navigation

User Story 1

"As a user, l want to see information about the GT Movies Store so l can learn moreabout the app and its purpose."

  • Homepage: home/index.html (under home/ App) provides a simple welcome message.
  • About: home/about.html (under home/ App) details features and goals.
  • Footer (defined in base.html) contains contact info and a brief app description.

User Stories 15 to 16

Responsive design

  • Bootstrap-based layout (Support different screen sizes).

User Authentication

User Stories 2 to 3

User registration and login functionality

  • Views: signup() and login() in accounts/views.py (accounts/).
  • Form: CustomUserCreationForm for sign-up customized from Django's UserCreationForm.
  • Password validation, error handling, and session management from Django.

Movie Browsing and Search

User Stories 4 to 5

View the movie list and search for movies

  • List view: index() in movies/views.py (movies/).
  • Search: Django ORM icontains filter by title;
  • Backed by Movie model (title, price, description, image) in movies/.

User Story 13

View movie details

  • Template: movies/show.html (movies/) shows details (description, price, image) and reviews.
  • Reviews provided by Review model in movies/.

Shopping Cart

User Stories 6 to 7, 9

Shopping cart functionality

  • Cart stored in the database using models in cart/.
  • Views: add/remove/clear in cart/views.py.
  • Totals price computed using calculate_cart_total(cart, movies_in_cart) in cart/utils.py.
  • Supports multiple quantities per movie.
  • Orders recorded by Order (total, date, user) and Item (price, quantity, movie) models in cart/.

Review System

User Stories 8, 10 to 12

Movie review functionality

  • CRUD operations for reviews in movies/views.py (movies/).
  • Users can edit only their own reviews.
  • Reviews displayed in chronological order.
  • Data model: Review (content, date, user, movie) in movies/.

Order Management

User Story 14

View order history

  • Template: accounts/orders.html (accounts/) lists past orders (purchase date, total price, item list).

Administration

User Stories 17 to 20

Administrator management

  • Django Admin configured in admin.py.
  • Admins can CRUD users, movies, reviews, and orders.

Deployment

Pythonanywhere