Django Online Marketplace Course Notes

Jul 29, 2024

Django Online Marketplace Course Notes

Introduction

  • Instructor: Stein
  • Course Focus: Build an online marketplace using Django
  • Key Features: Authentication, communication between users, item dashboard, form handling, etc.
  • Prerequisite Knowledge: Basic HTML

Project Overview

  • Demo Provided: Overview of the frontend layout
    • Menu with items: inbox, dashboard, browse items, create a new item
    • Display of the six newest items on the front page
    • Item filtering by category and search functionality
    • Inbox for user conversations
    • Item management on the dashboard

Project Development

  1. Environment Setup:

    • Create a virtual environment:
      python3 -m venv env
      
    • Activate it:
      source env/bin/activate
      
    • Install Django:
      pip install Django
      
    • Create a new Django project:
      django-admin startproject puddle
      
  2. Create Django Apps:

    • Create the core app:
      python manage.py startapp core
      
    • Register the core app in settings.py
  3. Creating Views and Templates:

    • Define views in views.py for the home page, contact page, etc.
    • Set up templates for rendering HTML.
  4. Base Template Creation:

    • Create a base.html template to avoid redundancy in the layout, and extend it in other templates.
  5. Categorization:

    • Setup the item app for handling items and categories:
      python manage.py startapp item
      
    • Create models for Category and Item in models.py
    • Migrate the database:
      python manage.py makemigrations
      python manage.py migrate
      
  6. Dashboard and Item Management:

    • Setup the dashboard for editing and deleting items.
    • Create item detail views and forms for editing items.

User Authentication

  • Setup User Registration:
    • Create user registration forms and views.
  • Login Functionality:
    • Implement login forms using Django’s built-in authentication views.

Conversations

  • Create conversation App:
    • Models for Conversation and ConversationMessage for user communication around items.
    • Implement views for creating new conversations and viewing messages.

Final Touches

  • Browse Functionality:

    • Implement search by item name and description.
    • Filter items by categories.
    • Create UI elements for filtering and search.
  • Inbox:

    • Create an inbox view to display conversations.
    • Details view for each conversation with the ability to send messages.

Conclusion

  • Complete Functionality: Users can create, edit, delete items, interact through conversations, and manage their profiles.
  • Encouragement to Expand: Use this project as a base for adding features like email verification, galleries, and more.