🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

django-trips

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

django-trips

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

1.0.4
PyPI
Maintainers
1

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.

  • TRIP_DESTINATIONS
  • TRIP_DEPARTURE_LOCATION
  • TRIP_LOCATIONS = TRIP_DEPARTURE_LOCATION + TRIP_DESTINATIONS
  • TRIP_HOSTS
  • TRIP_FACILITIES
  • TRIP_CATEGORIES
  • 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:

PageMethodURL
All Trips ListGEThttp://localhost:8000/api/v1/trips/
Upcoming Trips ListGEThttp://localhost:8000/api/v1/trips/upcoming/
Search TripGEThttp://localhost:8000/api/v1/trips/upcoming/?name=Boston/
Single TripGEThttp://localhost:8000/api/v1/trips/{identifier}/
Update TripPUThttp://localhost:8000/api/v1/trips/{identifier}/
Delete TripDELETEhttp://localhost:8000/api/v1/trips/{identifier}/
Create TripPOSThttp://localhost:8000/api/v1/trips/
Destinations ListGEThttp://localhost:8000/api/v1/destinations/
Destinations DetailGETTODO
All Trip BookingsGEThttp://localhost:8000/api/v1/trips/{trip_id}/bookings/
Book a TripPOSThttp://localhost:8000/api/v1/trips/{trip_id}/bookings/create/
Booking DetailsGEThttp://localhost:8000/api/v1/trips/bookings/{number}/
Update BookingPUThttp://localhost:8000/api/v1/trips/bookings/{number}/
Cancel BookingPOSThttp://localhost:8000/api/v1/trips/bookings/{number}/cancel/
Review TripGETTODO
Trip Reviews & CommentsGETTODO

API permissions

AuthenticationToken Life
SessionAuthenticationUNLIMITED
JWTAuthentication7 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

ActionCommand
Run Servermake dev.up
Trail Logsmake logs
Attach severmake attach
Stop servermake 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! ✨

Keywords

Django trips

FAQs

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts