Skip to main content

A Django Rest API for fetching and creating trips and their schedules.

Project description

Django Trips API

This is a Django REST API for managing and retrieving trips, schedules, bookings, and related travel data.

This service is a core component of the DestinationPak project — a platform designed to make exploring and booking adventures across Pakistan easier and more accessible.

Installation

Simply do:

pip install django-trips

Usage

Add the app into your installed apps in your project's settings file.

INSTALLED_APPS = [
    ...
    'django_trips',
]

Migrate

python manage.py migrate 

Add the following to your root urls.py or to your desired file location.

urlpatterns = [
    ...
    path('trips/', include(('django_trips.api.urls', 'trips-api'), namespace='trips-api')),
]

You can replace trips/ to any namespace you like for the api.

Generate random trips.

Before you generate random scripts, make sure you have the required settings available in your project. If you want to use the default settings set USE_DEFAULT_TRIPS=True. The script depends upon these variables, if you don't want to use the default settings set the following settings.

  1. TRIP_DESTINATIONS
  2. TRIP_DEPARTURE_LOCATION
  3. TRIP_LOCATIONS = TRIP_DEPARTURE_LOCATION + TRIP_DESTINATIONS
  4. TRIP_HOSTS
  5. TRIP_FACILITIES
  6. TRIP_CATEGORIES
  7. TRIP_GEARS
python manage.py generate_trips --batch_size=100

Change the batch_size variable to create as much of trips you want.

Developer Docs & API Documentation

You can access the all available API endpoints on the following links.

API Endpoints

The following pages are served in the development:

Page Method URL
All Trips List GET http://localhost:8000/api/v1/trips/
Upcoming Trips List GET http://localhost:8000/api/v1/trips/upcoming/
Search Trip GET http://localhost:8000/api/v1/trips/upcoming/?name=Boston/
Single Trip GET http://localhost:8000/api/v1/trips/{identifier}/
Update Trip PUT http://localhost:8000/api/v1/trips/{identifier}/
Delete Trip DELETE http://localhost:8000/api/v1/trips/{identifier}/
Create Trip POST http://localhost:8000/api/v1/trips/
Destinations List GET http://localhost:8000/api/v1/destinations/
Destinations Detail GET TODO
All Trip Bookings GET http://localhost:8000/api/v1/trips/{trip_id}/bookings/
Book a Trip POST http://localhost:8000/api/v1/trips/{trip_id}/bookings/create/
Booking Details GET http://localhost:8000/api/v1/trips/bookings/{number}/
Update Booking PUT http://localhost:8000/api/v1/trips/bookings/{number}/
Cancel Booking POST http://localhost:8000/api/v1/trips/bookings/{number}/cancel/
Review Trip GET TODO
Trip Reviews & Comments GET TODO

API permissions

Authentication Token Life
SessionAuthentication UNLIMITED
JWTAuthentication 7 Days
Permissions
IsAuthenticated
IsAdminUser

Develop Django Trips

Kick the docker build using the following command.

make build

This task may take few minutes.

Once the build has been completed, spin up the docker and migrate the database.

> make dev.up
> make shell 
> make update_db

Create a superuser with username admin.

> make shell
> python manage.py createsuperuser

Create batch of trips. Run the following command inside docker shell.

> python manage.py  generate_trips --batch_size=100
OR
> make random_trips

Test

Run tests using the following command.

make tests

Docker Commands

Action Command
Run Server make dev.up
Trail Logs make logs
Attach sever make attach
Stop server make stop
* Destroy docker container. make destory

* caution, this will remove all your data.

How to Contribute

Contributions are welcome! Whether it's bug fixes, new features, improving documentation, or sharing feedback — we'd love your help.

Please fork the repository, make your changes in a feature branch, and submit a pull request. For major changes, consider opening an issue first to discuss what you’d like to work on.


Thank you for being a part of the Django Trips journey.
Together, we can make travel management smarter, faster, and more delightful.

Reach out in you need further assistance. admin@destinationpak.com

Happy coding! ✨

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django_trips-1.0.4.tar.gz (17.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_trips-1.0.4-py3-none-any.whl (16.8 kB view details)

Uploaded Python 3

File details

Details for the file django_trips-1.0.4.tar.gz.

File metadata

  • Download URL: django_trips-1.0.4.tar.gz
  • Upload date:
  • Size: 17.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for django_trips-1.0.4.tar.gz
Algorithm Hash digest
SHA256 4b6c2513f2a58b731ea69ced136a56ce9b0eda0d36435c6819707878b64b02ef
MD5 b6ca14c80edd0ac87ba5fe89d76278d8
BLAKE2b-256 526a66b6dbc264f7d6ccdfd8c3aca04ed31462d7f3d6fa8fb9241d12963875c9

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_trips-1.0.4.tar.gz:

Publisher: release.yaml on awaisdar001/django-trips

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file django_trips-1.0.4-py3-none-any.whl.

File metadata

  • Download URL: django_trips-1.0.4-py3-none-any.whl
  • Upload date:
  • Size: 16.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for django_trips-1.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 730333372bcac6fe894dfa4faee67b6dc90d43aa8ed788622f8b134525fa3611
MD5 6c6d0134d3cdba8ee0d0903bc58c7b17
BLAKE2b-256 26c5ae87708f7025067289cd94cba9960043ad8be8914ad39f5afe92bb8d056b

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_trips-1.0.4-py3-none-any.whl:

Publisher: release.yaml on awaisdar001/django-trips

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page