commit
54bc863f5f
@ -0,0 +1,8 @@
|
||||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
# Editor-based HTTP Client requests
|
||||
/httpRequests/
|
||||
# Datasource local storage ignored files
|
||||
/dataSources/
|
||||
/dataSources.local.xml
|
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="PYTHON_MODULE" version="4">
|
||||
<component name="NewModuleRootManager">
|
||||
<content url="file://$MODULE_DIR$" />
|
||||
<orderEntry type="jdk" jdkName="django_env" jdkType="Python SDK" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
@ -0,0 +1,187 @@
|
||||
<component name="InspectionProjectProfileManager">
|
||||
<profile version="1.0">
|
||||
<option name="myName" value="Project Default" />
|
||||
<inspection_tool class="Eslint" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="PyPackageRequirementsInspection" enabled="true" level="WARNING" enabled_by_default="true">
|
||||
<option name="ignoredPackages">
|
||||
<value>
|
||||
<list size="159">
|
||||
<item index="0" class="java.lang.String" itemvalue="httpx" />
|
||||
<item index="1" class="java.lang.String" itemvalue="Babel" />
|
||||
<item index="2" class="java.lang.String" itemvalue="sorted-nearest" />
|
||||
<item index="3" class="java.lang.String" itemvalue="PyYAML" />
|
||||
<item index="4" class="java.lang.String" itemvalue="marshmallow" />
|
||||
<item index="5" class="java.lang.String" itemvalue="executing" />
|
||||
<item index="6" class="java.lang.String" itemvalue="fisher" />
|
||||
<item index="7" class="java.lang.String" itemvalue="gradio_client" />
|
||||
<item index="8" class="java.lang.String" itemvalue="Pygments" />
|
||||
<item index="9" class="java.lang.String" itemvalue="langchain" />
|
||||
<item index="10" class="java.lang.String" itemvalue="starlette" />
|
||||
<item index="11" class="java.lang.String" itemvalue="bleach" />
|
||||
<item index="12" class="java.lang.String" itemvalue="jupyter_server_terminals" />
|
||||
<item index="13" class="java.lang.String" itemvalue="soupsieve" />
|
||||
<item index="14" class="java.lang.String" itemvalue="uvicorn" />
|
||||
<item index="15" class="java.lang.String" itemvalue="jsonschema" />
|
||||
<item index="16" class="java.lang.String" itemvalue="terminado" />
|
||||
<item index="17" class="java.lang.String" itemvalue="comm" />
|
||||
<item index="18" class="java.lang.String" itemvalue="pydub" />
|
||||
<item index="19" class="java.lang.String" itemvalue="gunicorn" />
|
||||
<item index="20" class="java.lang.String" itemvalue="click" />
|
||||
<item index="21" class="java.lang.String" itemvalue="ipykernel" />
|
||||
<item index="22" class="java.lang.String" itemvalue="nbconvert" />
|
||||
<item index="23" class="java.lang.String" itemvalue="attrs" />
|
||||
<item index="24" class="java.lang.String" itemvalue="contourpy" />
|
||||
<item index="25" class="java.lang.String" itemvalue="psutil" />
|
||||
<item index="26" class="java.lang.String" itemvalue="dataclasses-json" />
|
||||
<item index="27" class="java.lang.String" itemvalue="jedi" />
|
||||
<item index="28" class="java.lang.String" itemvalue="openai" />
|
||||
<item index="29" class="java.lang.String" itemvalue="jupyter_server" />
|
||||
<item index="30" class="java.lang.String" itemvalue="natsort" />
|
||||
<item index="31" class="java.lang.String" itemvalue="asttokens" />
|
||||
<item index="32" class="java.lang.String" itemvalue="platformdirs" />
|
||||
<item index="33" class="java.lang.String" itemvalue="matplotlib" />
|
||||
<item index="34" class="java.lang.String" itemvalue="pandavro" />
|
||||
<item index="35" class="java.lang.String" itemvalue="jsonpatch" />
|
||||
<item index="36" class="java.lang.String" itemvalue="httpcore" />
|
||||
<item index="37" class="java.lang.String" itemvalue="referencing" />
|
||||
<item index="38" class="java.lang.String" itemvalue="json5" />
|
||||
<item index="39" class="java.lang.String" itemvalue="pyfaidx" />
|
||||
<item index="40" class="java.lang.String" itemvalue="numpy" />
|
||||
<item index="41" class="java.lang.String" itemvalue="requests" />
|
||||
<item index="42" class="java.lang.String" itemvalue="fastavro" />
|
||||
<item index="43" class="java.lang.String" itemvalue="grpcio-reflection" />
|
||||
<item index="44" class="java.lang.String" itemvalue="jupyter-events" />
|
||||
<item index="45" class="java.lang.String" itemvalue="websocket-client" />
|
||||
<item index="46" class="java.lang.String" itemvalue="sqlalchemy2-stubs" />
|
||||
<item index="47" class="java.lang.String" itemvalue="pysam" />
|
||||
<item index="48" class="java.lang.String" itemvalue="stack-data" />
|
||||
<item index="49" class="java.lang.String" itemvalue="methplotlib" />
|
||||
<item index="50" class="java.lang.String" itemvalue="zipp" />
|
||||
<item index="51" class="java.lang.String" itemvalue="nest-asyncio" />
|
||||
<item index="52" class="java.lang.String" itemvalue="tenacity" />
|
||||
<item index="53" class="java.lang.String" itemvalue="mmh3" />
|
||||
<item index="54" class="java.lang.String" itemvalue="prompt-toolkit" />
|
||||
<item index="55" class="java.lang.String" itemvalue="linkify-it-py" />
|
||||
<item index="56" class="java.lang.String" itemvalue="websockets" />
|
||||
<item index="57" class="java.lang.String" itemvalue="ipywidgets" />
|
||||
<item index="58" class="java.lang.String" itemvalue="pyarrow" />
|
||||
<item index="59" class="java.lang.String" itemvalue="watchfiles" />
|
||||
<item index="60" class="java.lang.String" itemvalue="tornado" />
|
||||
<item index="61" class="java.lang.String" itemvalue="aiofiles" />
|
||||
<item index="62" class="java.lang.String" itemvalue="jsonpointer" />
|
||||
<item index="63" class="java.lang.String" itemvalue="Send2Trash" />
|
||||
<item index="64" class="java.lang.String" itemvalue="plotly" />
|
||||
<item index="65" class="java.lang.String" itemvalue="overrides" />
|
||||
<item index="66" class="java.lang.String" itemvalue="python-multipart" />
|
||||
<item index="67" class="java.lang.String" itemvalue="toml" />
|
||||
<item index="68" class="java.lang.String" itemvalue="mistune" />
|
||||
<item index="69" class="java.lang.String" itemvalue="pandas" />
|
||||
<item index="70" class="java.lang.String" itemvalue="importlib-resources" />
|
||||
<item index="71" class="java.lang.String" itemvalue="toolz" />
|
||||
<item index="72" class="java.lang.String" itemvalue="mpmath" />
|
||||
<item index="73" class="java.lang.String" itemvalue="pyranges" />
|
||||
<item index="74" class="java.lang.String" itemvalue="debugpy" />
|
||||
<item index="75" class="java.lang.String" itemvalue="argon2-cffi" />
|
||||
<item index="76" class="java.lang.String" itemvalue="yarl" />
|
||||
<item index="77" class="java.lang.String" itemvalue="pytz" />
|
||||
<item index="78" class="java.lang.String" itemvalue="moreorless" />
|
||||
<item index="79" class="java.lang.String" itemvalue="Pillow" />
|
||||
<item index="80" class="java.lang.String" itemvalue="notebook_shim" />
|
||||
<item index="81" class="java.lang.String" itemvalue="traitlets" />
|
||||
<item index="82" class="java.lang.String" itemvalue="bowler" />
|
||||
<item index="83" class="java.lang.String" itemvalue="protobuf" />
|
||||
<item index="84" class="java.lang.String" itemvalue="rfc3339-validator" />
|
||||
<item index="85" class="java.lang.String" itemvalue="arrow" />
|
||||
<item index="86" class="java.lang.String" itemvalue="mypy" />
|
||||
<item index="87" class="java.lang.String" itemvalue="python-dotenv" />
|
||||
<item index="88" class="java.lang.String" itemvalue="nbclient" />
|
||||
<item index="89" class="java.lang.String" itemvalue="partd" />
|
||||
<item index="90" class="java.lang.String" itemvalue="MarkupSafe" />
|
||||
<item index="91" class="java.lang.String" itemvalue="locket" />
|
||||
<item index="92" class="java.lang.String" itemvalue="tinycss2" />
|
||||
<item index="93" class="java.lang.String" itemvalue="httptools" />
|
||||
<item index="94" class="java.lang.String" itemvalue="frozenlist" />
|
||||
<item index="95" class="java.lang.String" itemvalue="appdirs" />
|
||||
<item index="96" class="java.lang.String" itemvalue="python-json-logger" />
|
||||
<item index="97" class="java.lang.String" itemvalue="semantic-version" />
|
||||
<item index="98" class="java.lang.String" itemvalue="filelock" />
|
||||
<item index="99" class="java.lang.String" itemvalue="jupyterlab-widgets" />
|
||||
<item index="100" class="java.lang.String" itemvalue="pyzmq" />
|
||||
<item index="101" class="java.lang.String" itemvalue="certifi" />
|
||||
<item index="102" class="java.lang.String" itemvalue="anyio" />
|
||||
<item index="103" class="java.lang.String" itemvalue="Markdown" />
|
||||
<item index="104" class="java.lang.String" itemvalue="sympy" />
|
||||
<item index="105" class="java.lang.String" itemvalue="uvloop" />
|
||||
<item index="106" class="java.lang.String" itemvalue="notebook" />
|
||||
<item index="107" class="java.lang.String" itemvalue="beautifulsoup4" />
|
||||
<item index="108" class="java.lang.String" itemvalue="isoduration" />
|
||||
<item index="109" class="java.lang.String" itemvalue="jupyter-lsp" />
|
||||
<item index="110" class="java.lang.String" itemvalue="fqdn" />
|
||||
<item index="111" class="java.lang.String" itemvalue="jupyter_client" />
|
||||
<item index="112" class="java.lang.String" itemvalue="orjson" />
|
||||
<item index="113" class="java.lang.String" itemvalue="jupyterlab_server" />
|
||||
<item index="114" class="java.lang.String" itemvalue="altair" />
|
||||
<item index="115" class="java.lang.String" itemvalue="feast" />
|
||||
<item index="116" class="java.lang.String" itemvalue="fonttools" />
|
||||
<item index="117" class="java.lang.String" itemvalue="mdit-py-plugins" />
|
||||
<item index="118" class="java.lang.String" itemvalue="widgetsnbextension" />
|
||||
<item index="119" class="java.lang.String" itemvalue="charset-normalizer" />
|
||||
<item index="120" class="java.lang.String" itemvalue="uc-micro-py" />
|
||||
<item index="121" class="java.lang.String" itemvalue="biopython" />
|
||||
<item index="122" class="java.lang.String" itemvalue="dask" />
|
||||
<item index="123" class="java.lang.String" itemvalue="ffmpy" />
|
||||
<item index="124" class="java.lang.String" itemvalue="langsmith" />
|
||||
<item index="125" class="java.lang.String" itemvalue="numexpr" />
|
||||
<item index="126" class="java.lang.String" itemvalue="gradio" />
|
||||
<item index="127" class="java.lang.String" itemvalue="webcolors" />
|
||||
<item index="128" class="java.lang.String" itemvalue="async-timeout" />
|
||||
<item index="129" class="java.lang.String" itemvalue="SQLAlchemy" />
|
||||
<item index="130" class="java.lang.String" itemvalue="sklearn" />
|
||||
<item index="131" class="java.lang.String" itemvalue="cloudpickle" />
|
||||
<item index="132" class="java.lang.String" itemvalue="wcwidth" />
|
||||
<item index="133" class="java.lang.String" itemvalue="jupyter_core" />
|
||||
<item index="134" class="java.lang.String" itemvalue="importlib-metadata" />
|
||||
<item index="135" class="java.lang.String" itemvalue="rfc3986-validator" />
|
||||
<item index="136" class="java.lang.String" itemvalue="typeguard" />
|
||||
<item index="137" class="java.lang.String" itemvalue="ncls" />
|
||||
<item index="138" class="java.lang.String" itemvalue="jsonschema-specifications" />
|
||||
<item index="139" class="java.lang.String" itemvalue="rpds-py" />
|
||||
<item index="140" class="java.lang.String" itemvalue="uri-template" />
|
||||
<item index="141" class="java.lang.String" itemvalue="fissix" />
|
||||
<item index="142" class="java.lang.String" itemvalue="urllib3" />
|
||||
<item index="143" class="java.lang.String" itemvalue="jupyterlab" />
|
||||
<item index="144" class="java.lang.String" itemvalue="Cython" />
|
||||
<item index="145" class="java.lang.String" itemvalue="six" />
|
||||
<item index="146" class="java.lang.String" itemvalue="pyTelegramBotAPI" />
|
||||
<item index="147" class="java.lang.String" itemvalue="nbformat" />
|
||||
<item index="148" class="java.lang.String" itemvalue="ipython" />
|
||||
<item index="149" class="java.lang.String" itemvalue="dill" />
|
||||
<item index="150" class="java.lang.String" itemvalue="volatile" />
|
||||
<item index="151" class="java.lang.String" itemvalue="fastjsonschema" />
|
||||
<item index="152" class="java.lang.String" itemvalue="prometheus-client" />
|
||||
<item index="153" class="java.lang.String" itemvalue="tqdm" />
|
||||
<item index="154" class="java.lang.String" itemvalue="fastapi" />
|
||||
<item index="155" class="java.lang.String" itemvalue="proto-plus" />
|
||||
<item index="156" class="java.lang.String" itemvalue="aiohttp" />
|
||||
<item index="157" class="java.lang.String" itemvalue="grpcio" />
|
||||
<item index="158" class="java.lang.String" itemvalue="async-lru" />
|
||||
</list>
|
||||
</value>
|
||||
</option>
|
||||
</inspection_tool>
|
||||
<inspection_tool class="PyPep8NamingInspection" enabled="true" level="WEAK WARNING" enabled_by_default="true">
|
||||
<option name="ignoredErrors">
|
||||
<list>
|
||||
<option value="N803" />
|
||||
</list>
|
||||
</option>
|
||||
</inspection_tool>
|
||||
<inspection_tool class="PyUnresolvedReferencesInspection" enabled="true" level="WARNING" enabled_by_default="true">
|
||||
<option name="ignoredIdentifiers">
|
||||
<list>
|
||||
<option value="random.random.choice" />
|
||||
</list>
|
||||
</option>
|
||||
</inspection_tool>
|
||||
</profile>
|
||||
</component>
|
@ -0,0 +1,6 @@
|
||||
<component name="InspectionProjectProfileManager">
|
||||
<settings>
|
||||
<option name="USE_PROJECT_PROFILE" value="false" />
|
||||
<version value="1.0" />
|
||||
</settings>
|
||||
</component>
|
@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Black">
|
||||
<option name="sdkName" value="django_env" />
|
||||
</component>
|
||||
<component name="DiscordProjectSettings">
|
||||
<option name="show" value="ASK" />
|
||||
<option name="description" value="" />
|
||||
</component>
|
||||
<component name="MarkdownSettingsMigration">
|
||||
<option name="stateVersion" value="1" />
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" project-jdk-name="django_env" project-jdk-type="Python SDK" />
|
||||
</project>
|
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/franchise_store.iml" filepath="$PROJECT_DIR$/.idea/franchise_store.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
@ -0,0 +1,28 @@
|
||||
# Define default environment variables
|
||||
DJANGO_SETTINGS_MODULE ?= dev
|
||||
|
||||
# Default target
|
||||
.PHONY: help
|
||||
help:
|
||||
@echo "Available commands:"
|
||||
@echo " make run - Run the Django development server"
|
||||
@echo " make migrate - Apply database migrations"
|
||||
@echo " make createsuperuser - Create a Django superuser"
|
||||
|
||||
# Run the development server
|
||||
.PHONY: run
|
||||
run:
|
||||
@echo "Running Django server with settings: $(DJANGO_SETTINGS_MODULE)"
|
||||
DJANGO_SETTINGS_MODULE=$(DJANGO_SETTINGS_MODULE) python manage.py runserver
|
||||
|
||||
# Apply migrations
|
||||
.PHONY: migrate
|
||||
migrate:
|
||||
@echo "Applying migrations with settings: $(DJANGO_SETTINGS_MODULE)"
|
||||
DJANGO_SETTINGS_MODULE=$(DJANGO_SETTINGS_MODULE) python manage.py migrate
|
||||
|
||||
# Create a superuser
|
||||
.PHONY: createsuperuser
|
||||
createsuperuser:
|
||||
@echo "Creating superuser with settings: $(DJANGO_SETTINGS_MODULE)"
|
||||
DJANGO_SETTINGS_MODULE=$(DJANGO_SETTINGS_MODULE) python manage.py createsuperuser
|
@ -0,0 +1,31 @@
|
||||
version: '3.8'
|
||||
|
||||
services:
|
||||
db:
|
||||
image: postgres:15
|
||||
container_name: postgres_db
|
||||
environment:
|
||||
POSTGRES_USER: django_user
|
||||
POSTGRES_PASSWORD: secure_password
|
||||
POSTGRES_DB: django_db
|
||||
ports:
|
||||
- "5433:5432"
|
||||
volumes:
|
||||
- postgres_data:/var/lib/postgresql/data
|
||||
networks:
|
||||
- django_network
|
||||
|
||||
adminer:
|
||||
image: adminer
|
||||
container_name: adminer
|
||||
ports:
|
||||
- "8080:8080"
|
||||
networks:
|
||||
- django_network
|
||||
|
||||
volumes:
|
||||
postgres_data:
|
||||
|
||||
networks:
|
||||
django_network:
|
||||
driver: bridge
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,3 @@
|
||||
from django.contrib import admin
|
||||
|
||||
# Register your models here.
|
@ -0,0 +1,6 @@
|
||||
from django.apps import AppConfig
|
||||
|
||||
|
||||
class InventoryConfig(AppConfig):
|
||||
default_auto_field = 'django.db.models.BigAutoField'
|
||||
name = 'inventory'
|
@ -0,0 +1,72 @@
|
||||
# Generated by Django 5.1.4 on 2025-01-07 14:56
|
||||
|
||||
import django.db.models.deletion
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
initial = True
|
||||
|
||||
dependencies = [
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='Product',
|
||||
fields=[
|
||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('name', models.CharField(max_length=255, verbose_name='Наименование товара')),
|
||||
('manufacturer_name', models.CharField(max_length=255, verbose_name='Производитель')),
|
||||
('manufacturer_country', models.CharField(max_length=255, verbose_name='Страна производителя')),
|
||||
('manufacturer_code', models.CharField(blank=True, max_length=50, null=True, verbose_name='Код производителя')),
|
||||
('dimensions', models.CharField(blank=True, max_length=255, null=True, verbose_name='Размеры')),
|
||||
('unit_of_measure', models.CharField(max_length=50, verbose_name='Единица измерения')),
|
||||
('shelf_life_days', models.IntegerField(verbose_name='Срок годности (дни)')),
|
||||
('barcode', models.CharField(max_length=50, unique=True, verbose_name='Штрихкод')),
|
||||
],
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='StorageLocation',
|
||||
fields=[
|
||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('name', models.CharField(max_length=255, verbose_name='Наименование')),
|
||||
('type', models.CharField(choices=[('Store', 'Магазин'), ('Distribution Center', 'Распределительный центр'), ('Office', 'Офис')], max_length=50, verbose_name='Тип места хранения')),
|
||||
],
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='PriceList',
|
||||
fields=[
|
||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('price_type', models.CharField(choices=[('Regular', 'Регулярная'), ('Discount', 'Скидочная'), ('Promotional', 'Акционная')], max_length=50, verbose_name='Тип цены')),
|
||||
('entry_price', models.DecimalField(decimal_places=2, max_digits=10, verbose_name='Входная цена')),
|
||||
('final_price', models.DecimalField(decimal_places=2, max_digits=10, verbose_name='Итоговая цена')),
|
||||
('date_effective', models.DateField(verbose_name='Дата вступления в силу')),
|
||||
('constraint_percent_limit', models.DecimalField(decimal_places=2, default=1000, max_digits=5, verbose_name='Лимит на наценку (%)')),
|
||||
('constraint_price_change', models.DecimalField(decimal_places=2, default=90, max_digits=5, verbose_name='Лимит на изменение цены (%)')),
|
||||
('product', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='inventory.product', verbose_name='Товар')),
|
||||
],
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='StockOperation',
|
||||
fields=[
|
||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('operation_type', models.CharField(choices=[('Incoming', 'Приход'), ('Outgoing', 'Расход'), ('Transfer', 'Перемещение')], max_length=50, verbose_name='Тип операции')),
|
||||
('quantity', models.IntegerField(verbose_name='Количество')),
|
||||
('operation_date', models.DateTimeField(auto_now_add=True, verbose_name='Дата операции')),
|
||||
('expiration_date', models.DateField(blank=True, null=True, verbose_name='Срок годности')),
|
||||
('product', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='inventory.product', verbose_name='Товар')),
|
||||
('location', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='inventory.storagelocation', verbose_name='Место хранения')),
|
||||
],
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='Inventory',
|
||||
fields=[
|
||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('quantity', models.IntegerField(verbose_name='Количество')),
|
||||
('inventory_date', models.DateField(verbose_name='Дата инвентаризации')),
|
||||
('product', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='inventory.product', verbose_name='Товар')),
|
||||
('location', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='inventory.storagelocation', verbose_name='Место хранения')),
|
||||
],
|
||||
),
|
||||
]
|
Binary file not shown.
Binary file not shown.
@ -0,0 +1,72 @@
|
||||
from django.db import models
|
||||
|
||||
class Product(models.Model):
|
||||
name = models.CharField(max_length=255, verbose_name="Наименование товара")
|
||||
manufacturer_name = models.CharField(max_length=255, verbose_name="Производитель")
|
||||
manufacturer_country = models.CharField(max_length=255, verbose_name="Страна производителя")
|
||||
manufacturer_code = models.CharField(max_length=50, verbose_name="Код производителя", blank=True, null=True)
|
||||
dimensions = models.CharField(max_length=255, verbose_name="Размеры", blank=True, null=True)
|
||||
unit_of_measure = models.CharField(max_length=50, verbose_name="Единица измерения")
|
||||
shelf_life_days = models.IntegerField(verbose_name="Срок годности (дни)")
|
||||
barcode = models.CharField(max_length=50, unique=True, verbose_name="Штрихкод")
|
||||
|
||||
def __str__(self):
|
||||
return self.name
|
||||
|
||||
|
||||
class StorageLocation(models.Model):
|
||||
TYPE_CHOICES = [
|
||||
('Store', 'Магазин'),
|
||||
('Distribution Center', 'Распределительный центр'),
|
||||
('Office', 'Офис'),
|
||||
]
|
||||
name = models.CharField(max_length=255, verbose_name="Наименование")
|
||||
type = models.CharField(max_length=50, choices=TYPE_CHOICES, verbose_name="Тип места хранения")
|
||||
|
||||
def __str__(self):
|
||||
return self.name
|
||||
|
||||
|
||||
class StockOperation(models.Model):
|
||||
OPERATION_TYPE_CHOICES = [
|
||||
('Incoming', 'Приход'),
|
||||
('Outgoing', 'Расход'),
|
||||
('Transfer', 'Перемещение'),
|
||||
]
|
||||
product = models.ForeignKey(Product, on_delete=models.CASCADE, verbose_name="Товар")
|
||||
location = models.ForeignKey(StorageLocation, on_delete=models.CASCADE, verbose_name="Место хранения")
|
||||
operation_type = models.CharField(max_length=50, choices=OPERATION_TYPE_CHOICES, verbose_name="Тип операции")
|
||||
quantity = models.IntegerField(verbose_name="Количество")
|
||||
operation_date = models.DateTimeField(auto_now_add=True, verbose_name="Дата операции")
|
||||
expiration_date = models.DateField(blank=True, null=True, verbose_name="Срок годности")
|
||||
|
||||
def __str__(self):
|
||||
return f"{self.operation_type} - {self.product.name}"
|
||||
|
||||
|
||||
class PriceList(models.Model):
|
||||
PRICE_TYPE_CHOICES = [
|
||||
('Regular', 'Регулярная'),
|
||||
('Discount', 'Скидочная'),
|
||||
('Promotional', 'Акционная'),
|
||||
]
|
||||
product = models.ForeignKey(Product, on_delete=models.CASCADE, verbose_name="Товар")
|
||||
price_type = models.CharField(max_length=50, choices=PRICE_TYPE_CHOICES, verbose_name="Тип цены")
|
||||
entry_price = models.DecimalField(max_digits=10, decimal_places=2, verbose_name="Входная цена")
|
||||
final_price = models.DecimalField(max_digits=10, decimal_places=2, verbose_name="Итоговая цена")
|
||||
date_effective = models.DateField(verbose_name="Дата вступления в силу")
|
||||
constraint_percent_limit = models.DecimalField(max_digits=5, decimal_places=2, default=1000, verbose_name="Лимит на наценку (%)")
|
||||
constraint_price_change = models.DecimalField(max_digits=5, decimal_places=2, default=90, verbose_name="Лимит на изменение цены (%)")
|
||||
|
||||
def __str__(self):
|
||||
return f"{self.price_type} - {self.product.name}"
|
||||
|
||||
|
||||
class Inventory(models.Model):
|
||||
product = models.ForeignKey(Product, on_delete=models.CASCADE, verbose_name="Товар")
|
||||
location = models.ForeignKey(StorageLocation, on_delete=models.CASCADE, verbose_name="Место хранения")
|
||||
quantity = models.IntegerField(verbose_name="Количество")
|
||||
inventory_date = models.DateField(verbose_name="Дата инвентаризации")
|
||||
|
||||
def __str__(self):
|
||||
return f"Инвентаризация {self.product.name} - {self.location.name}"
|
@ -0,0 +1,3 @@
|
||||
from django.test import TestCase
|
||||
|
||||
# Create your tests here.
|
@ -0,0 +1,3 @@
|
||||
from django.shortcuts import render
|
||||
|
||||
# Create your views here.
|
@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env python
|
||||
import os
|
||||
import sys
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", f"settings.dev")
|
||||
|
||||
try:
|
||||
from django.core.management import execute_from_command_line
|
||||
except ImportError as exc:
|
||||
raise ImportError(
|
||||
"Couldn't import Django. Are you sure it's installed and "
|
||||
"available on your PYTHONPATH environment variable? Did you "
|
||||
"forget to activate a virtual environment?"
|
||||
) from exc
|
||||
|
||||
execute_from_command_line(sys.argv)
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,20 @@
|
||||
DATABASES = {
|
||||
'default': {
|
||||
'ENGINE': 'django.db.backends.postgresql',
|
||||
'NAME': 'django_db',
|
||||
'USER': 'django_user',
|
||||
'PASSWORD': 'secure_password',
|
||||
'HOST': '127.0.0.1',
|
||||
'PORT': '5433',
|
||||
}
|
||||
}
|
||||
|
||||
INSTALLED_APPS = [
|
||||
# 'django.contrib.admin',
|
||||
# 'django.contrib.auth',
|
||||
# 'django.contrib.contenttypes',
|
||||
# 'django.contrib.sessions',
|
||||
# 'django.contrib.messages',
|
||||
# 'django.contrib.staticfiles',
|
||||
'inventory',
|
||||
]
|
@ -0,0 +1,4 @@
|
||||
from .base import *
|
||||
|
||||
DEBUG = True
|
||||
ALLOWED_HOSTS = ["*"]
|
@ -0,0 +1,15 @@
|
||||
from .base import *
|
||||
|
||||
DEBUG = False
|
||||
ALLOWED_HOSTS = ['store.k-lab.su']
|
||||
|
||||
DATABASES = {
|
||||
'default': {
|
||||
'ENGINE': 'django.db.backends.postgresql',
|
||||
'NAME': 'django_db',
|
||||
'USER': 'django_user',
|
||||
'PASSWORD': 'secure_password',
|
||||
'HOST': 'db',
|
||||
'PORT': '5433',
|
||||
}
|
||||
}
|
Loading…
Reference in new issue