Coder Social home page Coder Social logo

pbp's Introduction

Power By People Challenge

Create a web client form and an API endpoint for travel permit inquiries using Django.

Input data

API must take the following fields as input:

  • Date of travel
  • Date of return (optional)
  • Country of origin
  • Country of destination
  • Age of traveller

Criteria Check:

  • Date of travel is between the next 2 and 5 following working days from the date of request. Otherwise, the travel permit must be denied.
  • If Date of return is present, and date of return is within 2 months of the Date of travel, then the travel can be approved. In any other case the travel permit must be denied.
  • Country of origin and Country of destination must be valid country names.
  • Travel is only allowed from countries where the number of Covid cases in the Country of origin is lower than in the Country of destination.
  • Travel is only allowed for travellers older than 21 and younger than 65. However, if a traveler is older than 15 years old, he/she can travel with the supervision of an adult. (You must show this prompt in your output when appropriate)
  • Tests for the above scenarios

Requirements

To run the solution ensure to meet the following:

  • Ubuntu 18+
  • Python3
  • Postgres10+

Setup

To run solution follow the steps below

# install required libraries
pip install -r requirements.txt
# Configure database
1. Access postgres service
2. Create database
3. Assignment priviledges to user
# Create .env
1. cp .env.example .env
2. Change variables according to your prefence

Run

Run develop server

# Migrate migrations
./manage.py migrate
# Run server
./manage.py runserver

Create Superuser

# Create Super User
./manage.py createsuperuser

Run Server

# Run Development Server
./manage.py runserver

Test

./manage.py test travel

Access Project

To access solution, open your preferred browser ensure the development server is running.

http://localhost:8000

To Access Travel Permit form page

http://localhost:8000/travel/permit/

API Collection

Postman Collection

Deployment Heroku Server

https://travelpermitpbp.herokuapp.com

Access Django Admin Panel

https://travelpermitpbp.herokuapp.com/admin

username: admin
password: admin123456

Github Clone Link

git clone

Time Breakdown

https://docs.google.com/document/d/1MZylx2UKexWxbwZNZmLpXzUeY2JaLWZDQ4Q8FphUvdk/edit?usp=sharing

pbp's People

Contributors

puse45 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.