Welcome to the Hotel Grand project documentation system. This documentation provides comprehensive coverage of the codebase, architecture, and data flows.
- Architecture Overview - System design and module organization
- Data Flow - How data moves through the system
- Module Documentation - Detailed docs for each app
- Configuration Files - Settings and URL routing
File: docs/ARCHITECTURE.md
Comprehensive overview of the Hotel Grand system architecture including:
- System architecture diagram
- Module structure and responsibilities
- Data model relationships
- Request/response flows
- Security features
- Deployment considerations
Key Sections:
- 4 main application modules
- 5-layer architecture (Client β Django β Application β Models β Data)
- Database schema overview
- File storage structure
- Development workflow
File: docs/DATA_FLOW.md
End-to-end data flow documentation showing how data moves through the system:
- User registration & authentication flow
- Room booking process
- Food ordering flow
- Room review & rating system
- Profile update operations
- Availability checking
- Database operations and file storage
- Error handling flows
Includes:
- Sequence diagrams for major operations
- Data input/output by module
- HTTP request/response examples
- Database operation examples
- Performance considerations
User authentication and profile management
Model Documentation:
accounts/models.py.md- UserProfile model
View Documentation:
accounts/views.py.md- Registration, login, profile management
Form Documentation:
accounts/forms.py.md- ProfileEditForm
URL Configuration:
accounts/urls.py.md- Account routing endpoints
Room management and reservation system
Model Documentation:
booking/models.py.md- Room, Booking, RoomImage, Review models
View Documentation:
booking/views.py.md- Booking operations, availability, reviews
Form Documentation:
booking/forms.py.md- PrivateBookingForm, AvailabilityForm, conflict detection
No URL Documentation: Booking URLs included in main hotelgrand/urls.py
Food service and ordering system
Model Documentation:
menu/models.py.md- MenuItem, Category, Rating, Order models
View Documentation:
menu/views.py.md- Menu display, order placement
URL Configuration:
menu/urls.py.md- Menu routing endpoints
Public-facing pages and utilities
View Documentation:
core/views.py.md- Home, about, public browsing pages
Model Documentation:
core/models.py.md- Empty (placeholder for future models)
File: hotelgrand/settings.py.md
Django configuration including:
- Debug and security settings
- Installed applications (4 custom + 6 Django apps)
- Middleware stack (7 components)
- Database configuration (MySQL)
- Template configuration
- CSRF and auth settings
File: hotelgrand/urls.py.md
Main URL dispatcher mapping requests to views:
- Admin panel
- Public endpoints (home, about, rooms, menu)
- Authentication routes (login, logout)
- App inclusion (accounts, booking, menu)
- Static/media file serving (development)
docs/
βββ README.md (this file)
βββ ARCHITECTURE.md
βββ DATA_FLOW.md
β
βββ accounts/
β βββ models.py.md
β βββ views.py.md
β βββ forms.py.md
β βββ urls.py.md
β
βββ booking/
β βββ models.py.md
β βββ views.py.md
β βββ forms.py.md
β
βββ menu/
β βββ models.py.md
β βββ views.py.md
β βββ urls.py.md
β
βββ core/
β βββ models.py.md
β βββ views.py.md
β
βββ hotelgrand/
βββ settings.py.md
βββ urls.py.md
- Start here: Read
ARCHITECTURE.mdfor system overview - Understand flows: Study
DATA_FLOW.md - Dive deep: Read individual module documentation
- Configuration: Check
hotelgrand/settings.py.mdfor Django setup
- Room Booking: See
booking/models.py.mdandbooking/views.py.md - User Accounts: See
accounts/models.py.mdandaccounts/views.py.md - Food Ordering: See
menu/models.py.mdandmenu/views.py.md
- Booking process: See
DATA_FLOW.mdsection "Room Booking Flow" - Order placement: See
DATA_FLOW.mdsection "Food Order Flow" - Authentication: See
DATA_FLOW.mdsection "User Registration & Authentication Flow"
- What apps are installed? See
hotelgrand/settings.py.md - What URLs are available? See
hotelgrand/urls.py.md - How is database configured? See
hotelgrand/settings.py.md
- User Management: Django's User + custom UserProfile
- Room Management: Room, RoomImage (multiple images per room)
- Bookings: Booking with auto-calculated pricing based on duration
- Reviews: Guest reviews for rooms with ratings
- Food Service: MenuItem (with category), Order, Rating
- Public Views: Home, about, room catalog, menu catalog (no auth required)
- Protected Views: Private booking, food ordering, reviews (login required)
- Admin Interface: Django admin for database management
- Booking Validation: Date range checking, room conflict detection
- Profile Forms: Image upload, password hashing
- Availability Filtering: Date-based room search
- Authentication: Django's built-in auth system
- CSRF Protection: Middleware + token validation
- Password Security: Hashing with Django's password hasher
User (Django)
βββ id, username, email, password
βββ UserProfile (One-to-One)
βββ role (customer/worker)
βββ profile_image
βββ loyalty_points
βββ dob, phone, address
βββ Methods: age, completion_percent()
Room
βββ name, description, price, capacity
βββ bedrooms, bathrooms, size
βββ images (One-to-Many: RoomImage)
RoomImage
βββ image or image_url
βββ caption, link_url
βββ get_image_source()
Booking
βββ room (FK)
βββ guest_name, check_in, check_out
βββ status, special_requests
βββ total_price (auto-calculated)
βββ rating, review
βββ save() auto-calculates price
Review
βββ room (FK), user (FK)
βββ text, rating
βββ created_at (auto)
Category
βββ name, description
βββ items (One-to-Many: MenuItem)
MenuItem
βββ category (FK)
βββ name, description, price
βββ estimated_time, loyalty_points
βββ image or image_url
βββ average_rating()
Rating
βββ menu_item (FK), user (FK)
βββ value (1-5)
Order
βββ user (FK), booking (FK)
βββ item (FK), quantity
βββ ordered_at, status
βββ status: pending β preparing β delivered
User Relationships:
- User ββ UserProfile (OneToOne)
- User β Review (many, writes reviews)
- User β Rating (many, rates items)
- User β Order (many, places orders)
Room Relationships:
- Room β Booking (many)
- Room β RoomImage (many)
- Room β Review (many)
Booking Relationships:
- Booking β Order (many, contains orders)
- Booking β Review (linked via Booking in data flow)
Menu Relationships:
- Category β MenuItem (many)
- MenuItem β Rating (many)
- MenuItem β Order (many)
GET / Home page
GET /about/ About page
GET /rooms/ Room catalog (paginated)
GET /menu/ Menu catalog (paginated)
GET/POST /login/ User login
GET /logout/ User logout
POST /accounts/register/ User registration
GET/POST /accounts/edit/ Edit profile
POST /accounts/update/username/ Update username
POST /accounts/update/email/ Update email
POST /accounts/update/photo/ Upload profile picture
POST /accounts/update/password/ Change password
POST /accounts/update/details/ Update personal info
GET/POST /book/private/ Private booking with filters
POST /book/check/ Check availability
GET /book/booking/success/ Booking confirmation
GET /book/room/<id>/ Room details & reviews
POST /book/extend-booking/ Extend existing booking
POST /book/submit-review/ Submit room review
GET /menu/private-menu/ View menu (must be checked-in)
POST /menu/place-order/ Place food order
- Authentication: Django's user authentication system
- CSRF Protection: Middleware + token validation in forms
- Password Security: PBKDF2 hashing, validation on registration
- SQL Injection: Protected by Django ORM
- Authorization: login_required decorator on protected views
- Role-Based: UserProfile.role field (customer/worker)
DEBUG = True(must be False in production)SECRET_KEYis insecure (change in production)ALLOWED_HOSTSis empty (specify domains in production)- Media files served by Django (use nginx/Apache in production)
- No REST API (web-only)
- No async task queue
- No caching layer
- No email notifications
- Local filesystem storage only
- Single MySQL database instance
- Engine: MySQL
- Database: hotelgrand_db
- User: django_user
- Host: localhost (default)
- Ensure: Database and user created before running
Each file follows a consistent 8-section structure:
- Overview - Purpose and responsibility
- File Location - Path in project
- Key Components - Classes, functions, variables
- Execution Flow - Step-by-step process
- Data Flow - Inputs, processing, outputs
- Mermaid Diagrams - Visual representations
- Error Handling & Edge Cases - Failures and special cases
- Example Usage - Code samples
Beginner β Intermediate β Advanced
- Read
ARCHITECTURE.mdto understand system layout - Skim
DATA_FLOW.mdfor high-level flows - Check
hotelgrand/urls.py.mdfor available endpoints
- Study
booking/models.py.mdfor data structures - Read
booking/views.py.mdfor business logic - Learn
accounts/models.py.mdfor user system
- Deep dive into
booking/views.py.mdfor conflict detection - Study
DATA_FLOW.mdfor complete request cycles - Review
hotelgrand/settings.py.mdfor configuration details
hotelgrand/ # Main project folder
βββ accounts/ # User account management
βββ booking/ # Room booking system
βββ menu/ # Food ordering
βββ core/ # Public pages
βββ hotelgrand/ # Project settings
βββ templates/ # HTML templates
βββ media/ # User uploads
βββ static/ # Static files
βββ manage.py # Django management
- Framework: Django 5.2.4
- Database: MySQL
- Frontend: HTML, CSS, JavaScript
- Authentication: Django's built-in system
- Forms: Django ModelForms
- Find it in the architecture diagram (
ARCHITECTURE.md) - Read the relevant module documentation
- Check
DATA_FLOW.mdfor the complete flow - Look at example usage section in module docs
- Find the view in
hotelgrand/urls.py.md - Read the view documentation (e.g.,
booking/views.py.md) - Check the models documentation for data structures
- Review data flow section in
DATA_FLOW.md
- Database:
hotelgrand/settings.py.md - URLs:
hotelgrand/urls.py.md - Apps:
ARCHITECTURE.mdβ Module Structure
| File | Type | Purpose |
|---|---|---|
ARCHITECTURE.md |
System | Overall architecture and design |
DATA_FLOW.md |
System | Data movement and processing |
accounts/models.py.md |
Module | User profile data model |
accounts/views.py.md |
Module | Authentication and profile views |
accounts/forms.py.md |
Module | Profile editing form |
accounts/urls.py.md |
Module | Account URL routing |
booking/models.py.md |
Module | Room and booking data models |
booking/views.py.md |
Module | Booking and availability logic |
booking/forms.py.md |
Module | Booking and search forms |
menu/models.py.md |
Module | Food and order data models |
menu/views.py.md |
Module | Menu and ordering views |
menu/urls.py.md |
Module | Menu URL routing |
core/models.py.md |
Module | Core model (empty) |
core/views.py.md |
Module | Public page views |
hotelgrand/settings.py.md |
Config | Django settings |
hotelgrand/urls.py.md |
Config | Main URL dispatcher |
Documentation created: January 2025
Covers:
- Django 5.2.4
- Hotel Grand v1.0
- 4 application modules
- All models, views, forms, and URLs
Happy coding! π