Restaurant Manager is a Django application designed to manage a restaurant.
It allows you to control inventory, orders, dishes, ingredients, and finances.
The project includes modules for tracking stock levels, calculating costs and revenue, and managing staff.
- Add, edit, and delete ingredients.
- Automatic tracking of stock (
stock_amount). - Calculation of unit price based on deliveries (
IngredientTransaction).
- Transaction types: Supply (
SUPPLY) and Waste (WASTE). - Automatic update of stock when a transaction is saved.
- Search and sorting by
ingredient,transaction_type,quantity,price_per_unit,created_at.
- Create dishes with assigned ingredients.
- Set price per portion (
price). - Assign chefs (
Chef) to dishes. - Search and sort by
name,dish_type,price.
- Create orders with multiple items (
OrderItem). - Automatic calculation of order
total_price. - Update ingredient stock after order is placed.
- Manage chefs (extension of
AbstractUser). - Store years of experience and salary (
salary).
- Calculate revenue (
revenue), employee costs (employee_costs), supply costs (supply_cost), and net profit (net_profit). - Include stock value in profit calculations (
profit_with_stock).
erDiagram
"CHEF (AbstractUser)" {
years_of_experience IntegerField
salary DecimalField
}
DISH {
name CharField
price DecimalField
description TextField
dish_type_id ForeignKey[DishType]
chefs List[Chef]
}
DISHTYPE {
name CharField
}
INGREDIENT {
name CharField
unit CharField
stock_amount DecimalField
price_per_unit DecimalFiled[calculated]
}
DISHINGREDIENT {
dish_id ForeignKey[Dish]
ingredient_id ForeignKey[Ingredient]
amount_required DecimalField
}
INGREDIENTTRANSACTION {
ingredient_id ForeignKey[Ingredient]
transaction_type CharField
quantity DecimalFied
price_per_unit DecimalField
created_at DateTimeField
expiration_date DateTimeField
note TextField
source_transactions List[INGREDIENTTRANSACTION]
}
ORDER {
created_at DateTimeField
}
ORDERITEM {
order_id ForeignKey[Order]
dish_id ForeignKey[Dish]
quantity PositiveIntegerField
}
"CHEF (AbstractUser)" }o--o{ DISH : prepares
DISHTYPE ||--o{ DISH : classifies
DISH ||--o{ DISHINGREDIENT : requires
INGREDIENT ||--o{ DISHINGREDIENT : used_in
INGREDIENT ||--o{ INGREDIENTTRANSACTION : tracked_by
INGREDIENTTRANSACTION }o--o{ INGREDIENTTRANSACTION : waste_from_supply
ORDER ||--o{ ORDERITEM : contains
DISH ||--o{ ORDERITEM : ordered_in
- Chef M2M Dish
- Chefs can prepare many dishes, and a dish can be assigned to multiple chefs.
- DishType 1 → Dish 0..*
- Each dish has exactly one type (DishType), and each type can classify many dishes.
- Dish 1 → DishIngredient 0..*
- Each dish can have multiple ingredients assigned via DishIngredient.
- Ingredient 1 → DishIngredient 0..* -Each ingredient can be used in multiple DishIngredient entries across different dishes.
- Ingredient 1 → IngredientTransaction 0..*
- Each ingredient can have multiple transactions (supply SUPPLY or waste WASTE).
- IngredientTransaction WASTE → IngredientTransaction SUPPLY
- A waste transaction (WASTE) can be linked to one or more supply transactions (SUPPLY) it originates from.
- Order 1 → OrderItem 0..*
- Each order can contain multiple order items (OrderItem).
- OrderItem 1 → Dish 1
- Each order item corresponds to exactly one dish.
- Dish M2M Order (przez OrderItem)
- Indirect relation: an order can include multiple dishes, each with a specified quantity.
- FinanceManager → (Chef, Ingredient, IngredientTransaction, Order)
- FinanceManager is not a table, but it uses all these models to calculate revenues, costs, and profits.
- Chef: User/chef with experience and salary.
- DishType: Type of dish.
- Ingredient: Ingredient with stock and unit price.
- IngredientTransaction: Supply or waste of ingredient.
- Dish: Dish with price and ingredients.
- DishIngredient: Amount of ingredient assigned to a dish.
- Order: Order with multiple items.
- OrderItem: Order item linked to a dish.
-
Clone repo:
git clone <repo-url> cd restaurant-manager
-
Create a virtual environment:
python -m venv .venv source .venv/bin/activate # Linux / macOS .venv\Scripts\activate # Windows
-
Install dependencies:
pip install -r requirements.txt
-
Run migrations:
python manage.py migrate
-
Start the development server:
python manage.py runserver
Restaurant Manager to aplikacja Django służąca do zarządzania restauracją. Umożliwia kontrolę zapasów, zamówień, dań, składników oraz finansów. Projekt zawiera moduły do śledzenia stanu magazynowego, obliczania kosztów i przychodów oraz zarządzania personelem.
- Dodawanie, edycja i usuwanie składników.
- Automatyczne śledzenie stanu magazynowego (
stock_amount). - Obliczanie ceny jednostkowej na podstawie dostaw (
IngredientTransaction).
- Typy transakcji: dostawa (
SUPPLY) i marnotrawstwo (WASTE). - Automatyczna aktualizacja stanu magazynowego przy zapisaniu transakcji.
- Możliwość wyszukiwania i sortowania według pola
ingredient,transaction_type,quantity,price_per_unit,created_at.
- Tworzenie dań z przypisanymi składnikami i typem dania.
- Ustalanie ceny za porcję (
price). - Możliwość przypisania kucharzy (
Chef) do dania. - Sortowanie i wyszukiwanie według
name,dish_type,price.
- Tworzenie zamówień z wieloma pozycjami (
OrderItem). - Automatyczne obliczanie
total_pricezamówienia. - Aktualizacja stanu składników po złożeniu zamówienia.
- Zarządzanie kucharzami (rozszerzenie
AbstractUser). - Przechowywanie lat doświadczenia i wynagrodzenia (
salary).
- Obliczanie przychodu (
revenue), kosztów pracowniczych (employee_costs), kosztów materiałów (supply_cost) oraz zysku netto (net_profit). - Uwzględnianie wartości zapasów w obliczeniach (
profit_with_stock).
erDiagram
"CHEF (AbstractUser)" {
years_of_experience IntegerField
salary DecimalField
}
DISH {
name CharField
price DecimalField
description TextField
dish_type_id ForeignKey[DishType]
chefs List[Chef]
}
DISHTYPE {
name CharField
}
INGREDIENT {
name CharField
unit CharField
stock_amount DecimalField
price_per_unit DecimalFiled[calculated]
}
DISHINGREDIENT {
dish_id ForeignKey[Dish]
ingredient_id ForeignKey[Ingredient]
amount_required DecimalField
}
INGREDIENTTRANSACTION {
ingredient_id ForeignKey[Ingredient]
transaction_type CharField
quantity DecimalFied
price_per_unit DecimalField
created_at DateTimeField
expiration_date DateTimeField
note TextField
source_transactions List[INGREDIENTTRANSACTION]
}
ORDER {
created_at DateTimeField
}
ORDERITEM {
order_id ForeignKey[Order]
dish_id ForeignKey[Dish]
quantity PositiveIntegerField
}
"CHEF (AbstractUser)" }o--o{ DISH : prepares
DISHTYPE ||--o{ DISH : classifies
DISH ||--o{ DISHINGREDIENT : requires
INGREDIENT ||--o{ DISHINGREDIENT : used_in
INGREDIENT ||--o{ INGREDIENTTRANSACTION : tracked_by
INGREDIENTTRANSACTION }o--o{ INGREDIENTTRANSACTION : waste_from_supply
ORDER ||--o{ ORDERITEM : contains
DISH ||--o{ ORDERITEM : ordered_in
- Chef M2M Dish
- Kucharze mogą przygotowywać wiele dań, a dania mogą być przypisane do wielu kucharzy.
- DishType 1 → Dish 0..*
- Każde danie ma dokładnie jeden typ (DishType), a każdy typ dania może klasyfikować wiele dań.
- Dish 1 → DishIngredient 0..*
- Każde danie może mieć wiele składników przypisanych poprzez DishIngredient.
- Ingredient 1 → DishIngredient 0..*
- Każdy składnik może być użyty w wielu pozycjach (DishIngredient) w różnych daniach.
- Ingredient 1 → IngredientTransaction 0..*
- Każdy składnik może mieć wiele transakcji (dostawa SUPPLY lub marnotrawstwo WASTE).
- IngredientTransaction WASTE → IngredientTransaction SUPPLY
- Transakcja marnotrawstwa (WASTE) może być powiązana z jedną lub wieloma transakcjami dostawy (SUPPLY), z których pochodzi.
- Order 1 → OrderItem 0..*
- Każde zamówienie może zawierać wiele pozycji (OrderItem).
- OrderItem 1 → Dish 1
- Każda pozycja zamówienia dotyczy dokładnie jednego dania.
- Dish M2M Order (przez OrderItem)
- Relacja pośrednia: zamówienie może zawierać wiele dań, każde z określoną ilością.
- FinanceManager → (Chef, Ingredient, IngredientTransaction, Order)
- FinanceManager nie jest tabelą, ale korzysta z danych wszystkich tych modeli, aby liczyć przychody, koszty i zyski.
-
Chef: użytkownik/kucharz z doświadczeniem i wynagrodzeniem.
-
DishType: typ dania.
-
Ingredient: składnik z magazynem i ceną jednostkową.
-
IngredientTransaction: dostawa lub marnotrawstwo składnika.
-
Dish: danie z ceną, składnikami i typem dania.
-
DishIngredient: ilość składnika przypisana do dania.
-
Order: zamówienie z wieloma pozycjami.
-
OrderItem: pozycja zamówienia powiązana z daniem.
-
FinanceManager: Agregacja danych finansowych z Chef, IngredientTransaction, Order
- Sklonuj repozytorium:
git clone <repo-url> cd restaurant-manager
- Utwórz wirtualne środowisko:
python -m venv .venv source .venv/bin/activate # Linux / macOS .venv\Scripts\activate # Windows
- Zainstaluj wymagane pakiety:
pip install -r requirements.txt
- Wykonaj migracje:
python manage.py migrate
- Uruchom serwer developerski:
python manage.py runserver