A Django + PostgreSQL web application for managing a car dealership domain: cars, manufacturers, inventory, buyers, sellers, and sales.
The project focuses on relational data modeling, reusable class-based views, server-side filtering/search, domain validation, and a simple local development setup.
- CRUD for countries, colors, manufacturers, cars, products, buyers, sellers, and sale acts
- Search across entity lists
- Filters for related entities and inventory state
- Pagination for list views
- Navigation through relational data
- Domain-level validation for prices, dimensions, engine power, colors, and sales
- PostgreSQL-backed persistence
- Reusable generic views and templates for common CRUD operations
- Environment-based configuration
- Docker Compose setup for the local PostgreSQL database
- Strict static type checking with
mypyanddjango-stubs - Code quality checks with
ruff
- Python 3.14+
- Django
- PostgreSQL
- psycopg
- uv
- Docker Compose
- mypy + django-stubs
- Ruff
The application is built around eight related entities covering reference data, the vehicle catalog, inventory, and sales.
erDiagram
Country ||--o{ Firm : contains
Country ||--o{ Car : origin
Firm ||--o{ Car : manufactures
Color ||--o{ Car : color
Car ||--o{ Product : listed_as
Product ||--o| SaleAct : sold_in
Buyer ||--o{ SaleAct : buys
Seller ||--o{ SaleAct : sells
Main entities:
Country— country reference dataColor— car color with a validated HEX valueFirm— manufacturer linked to a countryCar— vehicle model with manufacturer, country, color, dimensions, engine power, and release yearProduct— dealership inventory item with a priceBuyerandSeller— participants in a saleSaleAct— completed sale linking a product, buyer, seller, and timestamp
Application-level validation prevents the same product from being sold more than once.
The application uses Django class-based views and a small set of reusable abstractions instead of duplicating CRUD logic for every entity.
BaseEntityListView provides common list-page behavior such as pagination, search handling, table metadata, and value formatting. BaseEntityDetailView does the same for detail pages, while shared create/update/delete views provide common form behavior.
Entity-specific views extend these abstractions and add their own queryset optimizations and filters. Related objects are loaded with select_related() where appropriate to avoid unnecessary database queries.
The project uses server-rendered Django templates and PostgreSQL as the primary database.
The UI provides a single navigation layer across the main entities, searchable/filterable lists, detail pages, create/update forms, delete confirmation, and the standard Django admin interface.
The overview image above shows:
- The application home page
- The car list with filtering controls
- The sale creation form
- The Django admin panel
Examples of supported filtering:
- Manufacturers by country
- Cars by manufacturer and color
- Products by sold / available status
- Sale acts by seller
- Text search for names and car models
The domain model contains validation rules such as:
- HEX colors must use the
#RRGGBBformat - Car engine power, length, and width must be positive
- Product price must be positive
- One product cannot be referenced by multiple sale acts
git clone https://github.com/LEv145/car-dealership.git
cd car-dealershipCopy .env.example to .env:
cp .env.example .envOn Windows PowerShell:
Copy-Item .env.example .envDefault development values are already compatible with the included PostgreSQL Docker Compose configuration.
docker compose -f database/docker-compose.yml up -duv syncuv run python manage.py migrateuv run python manage.py runserverOpen http://127.0.0.1:8000/.
Run static type checking:
uv run mypy .Run Ruff:
uv run ruff check .car-dealership/
├── config/ # Django project configuration
├── dealership/ # Domain models, forms, views and URL routes
├── database/ # Local PostgreSQL Docker Compose setup
├── docs/images/ # Screenshots and diagrams used in the README
├── templates/ # Server-rendered templates
├── .env.example # Development environment template
├── manage.py
└── pyproject.toml
This project was developed as a university software-engineering project around an existing car-dealership database domain. The implementation emphasizes clean relational modeling, reusable Django abstractions, validation, search/filtering, and practical PostgreSQL integration rather than presenting a production-ready commercial system.

