An open API service indexing awesome lists of open source software.

https://github.com/sameer266/bus_ticket_booking


https://github.com/sameer266/bus_ticket_booking

Last synced: 10 months ago
JSON representation

Awesome Lists containing this project

README

          

# Bus Seat Booking System

A bus seat booking system built using Django, designed to allow bus operators to manage their buses, routes, and schedules while enabling customers to book seats on buses.

## Features

- **Bus Management**: Bus operators can manage buses, including bus types, routes, seat availability, and more.
- **Schedule Management**: Create and manage bus schedules, including departure/arrival times and ticket pricing.
- **Bus Admins**: Automatically assign bus admins when a schedule is created, ensuring efficient management of the system.
- **User Authentication**: Different user roles such as bus admins, customers, and staff.
- **Seat Booking**: Customers can select a seat and book tickets based on their required bus route and schedule.
- **Dynamic Pricing**: Set ticket prices for different schedules.
- **Data Validation**: Ensure integrity in the database, such as preventing available seats from exceeding total seats.

## Tech Stack

- **Backend**: Django, Python
- **Frontend**: HTML, CSS, JavaScript ,React js
- **Database**: SQLite (or other supported databases in Django)
- **User Authentication**: Custom user model with roles (admin, bus_admin, customer, etc.)

## Installation

### Prerequisites

- Python 3.8 or higher
- pip (Python package manager)

### 1. Clone the Repository

```bash
git clone https://github.com/sameer266/bus_ticket_booking/
cd bus-_booking
```

### 2. Install Dependencies

```bash
pip install -r requirements.txt
```

### 3. Set Up Database

Run the following command to apply migrations and set up the database schema:

```bash
python manage.py migrate
```

### 4. Create Superuser

To access the Django admin panel, create a superuser:

```bash
python manage.py createsuperuser
```

Follow the prompts to set up the superuser credentials.

### 5. Run the Development Server

Now you can start the Django development server:

```bash
python manage.py runserver
```

Access the application in your browser at `http://127.0.0.1:8000/`.

## Admin Panel

- **Login**: Go to `http://127.0.0.1:8000/admin/` and log in using the superuser credentials you created.
- **Manage Bus**: Add and manage buses, including bus types, seat availability, and assigned routes.
- **Manage Schedule**: Create and manage bus schedules, assign bus admins automatically, and set ticket prices.
- **Manage Users**: Create different users (Bus Admin, Customer) and assign them roles for access control.

## Models

### `Bus`
- `bus_number`: The unique identifier for the bus (e.g., "BA 1 KHA 1234").
- `bus_type`: Type of bus (e.g., "Tourist Bus", "Deluxe Bus").
- `total_seats`: Total number of seats on the bus.
- `available_seats`: Number of seats still available for booking.
- `route`: The route assigned to this bus.
- `is_active`: Whether the bus is active or inactive.
- `is_running`: Indicates if the bus is currently running.

### `BusAdmin`
- `user`: The user assigned as a bus admin.
- `bus`: The bus assigned to this bus admin.

### `Route`
- `source`: The starting point of the route.
- `destination`: The ending point of the route.
- `distance`: Distance in kilometers.
- `estimated_time`: Estimated travel time.

### `Schedule`
- `bus`: The bus for the schedule.
- `route`: The route assigned to the bus.
- `departure_time`: Time when the bus departs.
- `arrival_time`: Expected arrival time.
- `date`: The date and time of the journey.
- `price`: The ticket price for the schedule.
- `bus_admin`: The bus admin assigned to manage this schedule.

## User Roles

- **Admin**: Full access to manage buses, routes, schedules, and users.
- **Bus Admin**: Manages a specific bus and its associated schedule.
- **Customer**: Can book tickets for available schedules.

## Future Improvements

- Add features for customer booking and payment processing.
- Integrate a payment gateway for online ticket purchasing.
- Allow bus operators to view customer bookings.
- Provide email notifications for booking confirmations and schedule updates.
- Improve the user interface with a frontend framework like React or Vue.js.

## License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.