Giter VIP home page Giter VIP logo

django-pizza-example's Introduction

Test-Project

This is a simple project to show I'm confident with python/django.

The given task

Imagine a pizza ordering services with following functionality:

  • Order pizza . Order data: pizza id, pizza size (30cm/50cm), customer name, customer address (just plain text)
  • Update order
  • Remove order
  • See a list of customer orders

Tasks:

  1. Design Model/DB structure
  2. Design and implement API with Django (Rest) Framework for the described web service. Please note:
  • You don’t have to take care about authentication etc, we are just interested in structure and data modelling.
  • You don’t have to implement any UI, just the API endpoints
  1. Write test(s) for at least one of these endpoint(s)

Installation

Clone this git repository:

git clone https://github.com/dakrulski/django-pizza-example.git

Create a python virtual enviroment for python3 and activate it.

Go to the project folder:

cd pizza

Install the requirements:

pip install -r requirements.txt

Run the migrations:

python manage.py migrate

Start the server:

python manage.py runserver

This will start the webserver on http://127.0.0.1:8000/.

Documentation

The API endpoints are:

Endpoint Description
/order/list/<customer name>/ to list the orders from a customer
/order/create/ to create a new order
/modify/<pizza id>/ to update and delete an order

An automatic generated interactive API documentation can be found under http://127.0.0.1:8000/docs/ if the server is running.

Tests

To run the tests:

python manage.py test

If I had more time, these are the things I would have done differently

  • Definitely implement authorization and authentication
  • Make the models more complex. For example add a customer model with a referenced address model, add a model for different pizza sizes and add a model for prices with reference to the size model and to the pizza model.

django-pizza-example's People

Contributors

dakrulski 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.