A comprehensive, full-featured hotel booking and management system built with Django. This application provides both a customer-facing booking interface and a powerful administrative panel for hotel management.
- Features
- System Architecture
- Installation
- Configuration
- Usage
- API Documentation
- Admin Panel
- Database Schema
- Payment Integration
- Security Features
- Mobile Responsiveness
- Contributing
- π Hotel Showcase: Beautiful, responsive hotel presentation with image galleries
- π Room Search & Filtering: Advanced search with date range, guest count, and room type filters
- π Real-time Availability: Live room availability checking with conflict prevention
- π³ Secure Booking: Complete booking workflow with payment integration
- π± Mobile-First Design: Fully responsive design optimized for all devices
- π§ Contact System: Integrated contact forms with email notifications
- π¨ Modern UI/UX: Clean, professional interface with smooth animations
- π Comprehensive Dashboard: Real-time analytics and booking insights
- π¨ Hotel Management: Multi-hotel support with detailed property management
- ποΈ Room Management: Complete room inventory with types, amenities, and pricing
- π Booking Management: Full booking lifecycle management with status tracking
- π₯ Guest Management: Customer database with booking history
- π° Financial Tracking: Revenue analytics and payment monitoring
- π User Management: Role-based access control with custom permissions
- π Reporting: Detailed reports and analytics
- π Role-Based Access Control (RBAC): Granular permission system
- π€ User Profile Management: Extended user profiles with avatars
- π Secure Authentication: Django's built-in authentication with custom enhancements
- π‘οΈ CSRF Protection: Complete protection against cross-site request forgery
- π Permission Management: Custom permission system for fine-grained control
- ποΈ Soft Delete System: Data preservation with soft delete functionality
- π Audit Trail: Complete tracking of data changes and user actions
- πΎ Data Validation: Comprehensive validation at model and form levels
- π Data Integrity: Foreign key constraints and business rule enforcement
- π³ Paystack Integration: Secure payment processing with Paystack
- π§ Email System: SMTP integration for notifications and confirmations
- π RESTful APIs: AJAX endpoints for dynamic functionality
- π± Responsive Design: Bootstrap-based responsive framework
hotel_booking/
βββ myhotel/ # Main Django project
β βββ hotel/ # Customer-facing application
β β βββ models.py # Core business models
β β βββ views.py # Customer views and booking logic
β β βββ forms.py # Customer forms and validation
β β βββ templates/ # Customer-facing templates
β β βββ static/ # CSS, JS, images for customer site
β β βββ booking.py # Booking business logic
β β βββ room_availability.py # Availability checking system
β β βββ context_processors.py # Template context processors
β β
β βββ admin_panel/ # Administrative application
β β βββ views/ # Admin views (modular structure)
β β β βββ dashboard.py # Dashboard and analytics
β β β βββ booking_views.py # Booking management
β β β βββ room_views.py # Room management
β β β βββ guest_views.py # Guest management
β β β βββ hotel_views.py # Hotel management
β β β βββ user_manager_views.py # User management
β β β βββ permission_views.py # Permission management
β β βββ templates/ # Admin panel templates
β β βββ static/ # Admin panel assets
β β βββ forms.py # Admin forms
β β
β βββ myhotel/ # Project settings
β β βββ settings.py # Django configuration
β β βββ urls.py # URL routing
β β βββ wsgi.py # WSGI configuration
β β
β βββ media/ # User-uploaded files
β βββ manage.py # Django management script
β βββ db.sqlite3 # SQLite database
β
βββ requirements.txt # Python dependencies
βββ .env # Environment variables
βββ .gitignore # Git ignore rules
βββ README.md # This file
- Backend: Django 5.2.4 (Python web framework)
- Database: SQLite (development) / PostgreSQL (production ready)
- Frontend: HTML5, CSS3, JavaScript (ES6+)
- UI Framework: Bootstrap 5.3.0 with custom styling
- Icons: Font Awesome 6.0.0
- Fonts: Google Fonts (Playfair Display, Inter)
- Payment: Paystack API integration
- Email: SMTP with Django's email framework
- Python 3.8 or higher
- pip (Python package installer)
- Git
-
Clone the Repository
git clone <repository-url> cd hotel_booking
-
Create Virtual Environment
python -m venv .venv # On Windows .venv\Scripts\activate # On macOS/Linux source .venv/bin/activate
-
Install Dependencies
pip install -r requirements.txt
-
Environment Configuration Create a
.envfile in themyhotel/directory:SECRET_KEY=your-secret-key-here PAYSTACK_SECRET_KEY=your-paystack-secret-key PAYSTACK_PUBLIC_KEY=your-paystack-public-key EMAIL_HOST=your-smtp-host EMAIL_PORT=587 EMAIL_HOST_USER=your-email@example.com EMAIL_HOST_PASSWORD=your-email-password DEFAULT_FROM_EMAIL=your-email@example.com
-
Database Setup
cd myhotel python manage.py makemigrations python manage.py migrate -
Create Superuser
python manage.py createsuperuser
-
Collect Static Files
python manage.py collectstatic
-
Run Development Server
python manage.py runserver
-
Access the Application
- Customer Site: http://127.0.0.1:8000/hotel/
- Admin Panel: http://127.0.0.1:8000/hotel/admin/
- Django Admin: http://127.0.0.1:8000/admin/
| Variable | Description | Required |
|---|---|---|
SECRET_KEY |
Django secret key for cryptographic signing | Yes |
PAYSTACK_SECRET_KEY |
Paystack secret key for payment processing | Yes |
PAYSTACK_PUBLIC_KEY |
Paystack public key for frontend integration | Yes |
EMAIL_HOST |
SMTP server hostname | Yes |
EMAIL_PORT |
SMTP server port | Yes |
EMAIL_HOST_USER |
SMTP username | Yes |
EMAIL_HOST_PASSWORD |
SMTP password | Yes |
DEFAULT_FROM_EMAIL |
Default sender email address | Yes |
The application uses SQLite by default for development. For production, configure PostgreSQL:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'NAME': 'hotel_booking_db',
'USER': 'your_db_user',
'PASSWORD': 'your_db_password',
'HOST': 'localhost',
'PORT': '5432',
}
}- Browse Hotels: View hotel information, amenities, and room types
- Search Availability: Use the booking form to check room availability
- Select Rooms: Choose from available room types with detailed information
- Make Booking: Complete the booking form with guest details
- Payment: Secure payment processing through Paystack
- Confirmation: Receive booking confirmation and receipt
- Dashboard Access: Login to the admin panel for overview analytics
- Hotel Setup: Configure hotel information, amenities, and room types
- Room Management: Add rooms, set pricing, and manage availability
- Booking Management: View, edit, and manage customer bookings
- Guest Management: Access customer database and booking history
- User Management: Create staff accounts with appropriate permissions
- Reports: Generate and view various business reports
Endpoint: /hotel/admin/api/check-room-availability/
Method: POST
Purpose: Check room availability for specific dates
Request Body:
{
"checkin": "2024-01-15",
"checkout": "2024-01-20",
"room_type": 1,
"guests": 2
}Response:
{
"available": true,
"available_rooms": 3,
"total_price": 500.00,
"nights": 5
}Endpoint: /hotel/contact/submit/
Method: POST
Purpose: Submit contact form
Request Body:
{
"name": "John Doe",
"email": "john@example.com",
"subject": "Inquiry",
"message": "Hello, I have a question..."
}- π Booking Analytics: Real-time booking statistics and trends
- π° Revenue Tracking: Financial performance metrics
- π Occupancy Rates: Room utilization analytics
- π― Quick Actions: Fast access to common administrative tasks
- Hotel information and branding
- Contact details and descriptions
- Logo and image management
- Amenity configuration
- Room type creation and editing
- Pricing and capacity management
- Amenity assignment
- Image gallery management
- Individual room tracking
- Booking status tracking (Pending, Confirmed, Cancelled)
- Payment status monitoring
- Guest information management
- Special request handling
- Booking modification and cancellation
- Staff account creation
- Role and permission assignment
- User profile management
- Activity monitoring
- Custom permission creation
- Role-based access control
- Granular permission assignment
- Permission auditing
- Basic hotel information
- Contact details
- Branding assets
- Room categories and descriptions
- Pricing and capacity
- Amenity relationships
- Image management
- Individual room instances
- Room number tracking
- Availability status
- Hotel association
- Reservation details
- Guest information
- Payment tracking
- Status management
- Customer information
- Contact details
- Booking history
- Custom permission definitions
- Content type associations
- Permission type categorization
- Permission groupings
- Role descriptions
- Active status tracking
- User-role assignments
- Assignment tracking
- Audit trail
- Secure Processing: PCI-compliant payment handling
- Multiple Payment Methods: Card payments, bank transfers
- Transaction Tracking: Complete payment audit trail
- Webhook Support: Real-time payment status updates
- Refund Management: Automated refund processing
- Customer completes booking form
- Payment amount calculated automatically
- Secure redirect to Paystack payment page
- Payment processing and verification
- Booking confirmation and receipt generation
- Email notifications sent to customer and admin
- Django Authentication: Built-in user authentication system
- Custom Permissions: Granular access control
- Role-Based Access: Hierarchical permission system
- Session Management: Secure session handling
- Password Validation: Strong password requirements
- CSRF Protection: Cross-site request forgery prevention
- SQL Injection Prevention: Parameterized queries
- XSS Protection: Output escaping and sanitization
- Soft Delete: Data preservation and recovery
- Audit Logging: Complete action tracking
- Environment Variables: Sensitive data protection
- HTTPS Ready: SSL/TLS configuration support
- Security Headers: Comprehensive security headers
- Input Validation: Server-side validation for all inputs
- Mobile-First Approach: Optimized for mobile devices
- Responsive Grid: Bootstrap-based responsive layout
- Touch-Friendly: Large touch targets and intuitive navigation
- Fast Loading: Optimized images and minimal JavaScript
- Cross-Browser: Compatible with all modern browsers
- Hamburger Menu: Collapsible navigation for mobile
- Touch Gestures: Swipe and touch interactions
- Optimized Forms: Mobile-friendly form layouts
- Image Optimization: Responsive images with proper sizing
- Performance: Minimal load times on mobile networks
# Run all tests
python manage.py test
# Run specific app tests
python manage.py test hotel
python manage.py test admin_panel
# Run with coverage
coverage run --source='.' manage.py test
coverage report- Model validation tests
- View functionality tests
- Form validation tests
- API endpoint tests
- Authentication tests
- Permission system tests
- Set
DEBUG = False - Configure production database
- Set up static file serving
- Configure email backend
- Set up SSL/HTTPS
- Configure allowed hosts
- Set up monitoring and logging
- Configure backup strategy
- Traditional Hosting: Apache/Nginx + Gunicorn
- Cloud Platforms: AWS, Google Cloud, Azure
- Platform as a Service: Heroku, PythonAnywhere
- Containerization: Docker deployment ready
We welcome contributions to improve the Hotel Booking Management System!
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
- Follow PEP 8 style guidelines
- Write comprehensive tests for new features
- Update documentation for any changes
- Ensure backward compatibility
- Add appropriate error handling
- Use meaningful variable and function names
- Add docstrings to all functions and classes
- Follow Django best practices
- Maintain consistent indentation (4 spaces)
For support, questions, or feature requests:
- Documentation: Check this README and inline code documentation
- Issues: Open an issue on the GitHub repository
- Email: Contact the development team
- Community: Join our developer community discussions
- Django framework and community
- Bootstrap for responsive design
- Font Awesome for icons
- Paystack for payment processing
- All contributors and testers
Built with β€οΈ using Django
This project demonstrates modern web development practices with Django, including responsive design, secure payment processing, comprehensive admin functionality, and production-ready architecture.