Skip to content

turing95/django_showcase

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

django_showcase

Containerized Django + DRF showcase project with employee and salary-statistics endpoints.

Quick Start

docker compose up

Application URL: http://localhost:8000

Run Tests

docker compose run web python3 manage.py test

Authentication

You can use either token or basic authentication.

Token flow:

  1. Open http://localhost:8000/admin/authtoken/tokenproxy/
  2. Login with:
    • username: clipboard
    • password: clipboard
  3. Use the returned token as Authorization: Token <TOKEN>

Basic auth:

  • clipboard:clipboard

API Examples

Create employee:

curl http://localhost:8000/employees/ \
  -H "Content-Type: application/json" \
  -H "Authorization: Token YOUR_TOKEN" \
  -d '{"name":"Marco","salary":"145000","currency":"USD","department":"Engineering","sub_department":"Machine Learning"}'

Delete employee:

curl -X DELETE http://localhost:8000/employees/EMPLOYEE_UUID/ \
  -H "Authorization: Token YOUR_TOKEN"

Get overall salary stats:

curl http://localhost:8000/ss/ \
  -H "Authorization: Token YOUR_TOKEN"

Get salary stats filtered by contract:

curl "http://localhost:8000/ss/?on_contract=true" \
  -H "Authorization: Token YOUR_TOKEN"

Get salary stats filtered by currency:

curl "http://localhost:8000/ss/?currency=EUR" \
  -H "Authorization: Token YOUR_TOKEN"

Get salary stats by department:

curl http://localhost:8000/departments/ss/ \
  -H "Authorization: Token YOUR_TOKEN"

Get salary stats by department/sub-department:

curl http://localhost:8000/sub_departments/ss/ \
  -H "Authorization: Token YOUR_TOKEN"

Implementation Notes

  • Django + Django REST Framework + SQLite
  • Serializer-based validation for request and response payloads
  • Department/sub-department modeled as dedicated entities
  • Demo data initialization command runs during first container startup

About

Containerized Django showcase project with reproducible local setup

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages