gold eggs backend
Some checks failed
Build and Push to Docker Hub / build-test-push (push) Failing after 1m55s
Some checks failed
Build and Push to Docker Hub / build-test-push (push) Failing after 1m55s
This commit is contained in:
42
.env.example
Normal file
42
.env.example
Normal file
@@ -0,0 +1,42 @@
|
||||
# Django configs
|
||||
DJANGO_SECRET_KEY=key
|
||||
DEBUG=True
|
||||
DJANGO_SETTINGS_MODULE=config.settings.local
|
||||
COMMAND=sh ./scripts/entrypoint.sh
|
||||
|
||||
# Databse configs
|
||||
# https://docs.djangoproject.com/en/4.2/ref/settings/#databases
|
||||
DB_ENGINE=django.db.backends.postgresql_psycopg2
|
||||
DB_NAME=django
|
||||
DB_USER=postgres
|
||||
DB_PASSWORD=2309
|
||||
DB_HOST=db
|
||||
DB_PORT=5432
|
||||
|
||||
# Cache
|
||||
CACHE_BACKEND=django.core.cache.backends.redis.RedisCache
|
||||
REDIS_URL=redis://redis:6379
|
||||
CACHE_ENABLED=False
|
||||
CACHE_TIMEOUT=120
|
||||
|
||||
# Vite settings
|
||||
VITE_LIVE=False
|
||||
VITE_PORT=5173
|
||||
VITE_HOST=127.0.0.1
|
||||
|
||||
# Sms service
|
||||
SMS_API_URL=https://notify.eskiz.uz/api
|
||||
SMS_LOGIN=admin@gmail.com
|
||||
SMS_PASSWORD=key
|
||||
|
||||
# Addition
|
||||
ALLOWED_HOSTS=127.0.0.1,https://one-sheep-happily.ngrok-free.app,web
|
||||
CSRF_TRUSTED_ORIGINS=https://one-sheep-happily.ngrok-free.app,http://127.0.0.1:88
|
||||
|
||||
# ngrok service
|
||||
NGROK_AUTHTOKEN=token
|
||||
NGROK_DOMAIN=
|
||||
NGROK_ADMIN_PORT=4040
|
||||
|
||||
# Celery
|
||||
CELERY_PORT=5555
|
||||
125
.github/workflows/deploy.yaml
vendored
Normal file
125
.github/workflows/deploy.yaml
vendored
Normal file
@@ -0,0 +1,125 @@
|
||||
name: Build and Push to Docker Hub
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
env:
|
||||
PROJECT_NAME: eggs
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
jobs:
|
||||
build-test-push:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Copy env
|
||||
run: |
|
||||
cp .env.example .env
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Build Docker image
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: .
|
||||
file: ./Dockerfile
|
||||
push: false
|
||||
load: true
|
||||
tags: ${{ env.PROJECT_NAME }}:test
|
||||
no-cache: true
|
||||
|
||||
|
||||
- name: Login to Docker Hub
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
username: ${{ secrets.DOCKER_USERNAME }}
|
||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||
|
||||
- name: Tag and push to Docker Hub
|
||||
run: |
|
||||
docker tag ${{ env.PROJECT_NAME }}:test ${{ secrets.DOCKER_USERNAME }}/${{ env.PROJECT_NAME }}:latest
|
||||
docker tag ${{ env.PROJECT_NAME }}:test ${{ secrets.DOCKER_USERNAME }}/${{ env.PROJECT_NAME }}:${{ github.run_number }}
|
||||
docker push ${{ secrets.DOCKER_USERNAME }}/${{ env.PROJECT_NAME }}:latest
|
||||
docker push ${{ secrets.DOCKER_USERNAME }}/${{ env.PROJECT_NAME }}:${{ github.run_number }}
|
||||
echo "SUCCESS TAGS: latest, ${{ github.run_number }}"
|
||||
|
||||
- name: stack.yaml updated
|
||||
run: |
|
||||
sed -i 's|image: ${{ secrets.DOCKER_USERNAME }}/${{ env.PROJECT_NAME }}:.*|image: ${{ secrets.DOCKER_USERNAME }}/${{ env.PROJECT_NAME }}:${{ github.run_number }}|' stack.yaml
|
||||
sed -i 's/return HttpResponse("OK.*"/return HttpResponse("OK: #${{ github.sha }}"/' routes/common.py
|
||||
|
||||
- name: Commit and push updated version
|
||||
run: |
|
||||
git config user.name "github-actions[bot]"
|
||||
git config user.email "github-actions[bot]@users.noreply.github.com"
|
||||
git add .
|
||||
git commit -m "🔄 image to ${{ github.run_number }} [CI SKIP]" || echo "No changes"
|
||||
git pull origin main --rebase
|
||||
git push origin main
|
||||
|
||||
- name: Execute remote SSH commands using SSH key
|
||||
uses: appleboy/ssh-action@v1.2.2
|
||||
with:
|
||||
host: ${{ secrets.HOST }}
|
||||
username: ${{ secrets.USERNAME }}
|
||||
# key: ${{ secrets.KEY }}
|
||||
password: ${{ secrets.PASSWORD }}
|
||||
port: ${{ secrets.PORT }}
|
||||
script: |
|
||||
sudo su
|
||||
PROJECTS=/opt/projects/
|
||||
DIR=/opt/projects/${{ env.PROJECT_NAME }}/
|
||||
|
||||
if [ -d "$PROJECTS" ]; then
|
||||
echo "projects papkasi mavjud"
|
||||
else
|
||||
mkdir -p $PROJECTS
|
||||
echo "projects papkasi yaratildi"
|
||||
fi
|
||||
|
||||
if [ -d "$DIR" ]; then
|
||||
echo "loyiha mavjud"
|
||||
else
|
||||
cd $PROJECTS
|
||||
echo ${{ github.repository }}
|
||||
sudo git clone git@github.com:${{ github.repository }}.git ${{ env.PROJECT_NAME }}
|
||||
echo "Clone qilindi";
|
||||
fi
|
||||
|
||||
cd $DIR
|
||||
sudo git fetch origin main
|
||||
sudo git reset --hard origin/main
|
||||
sudo cp .env.example .env
|
||||
|
||||
update_env() {
|
||||
local env_file=".env"
|
||||
sudo cp .env.example "$env_file"
|
||||
|
||||
# argumentlar orqali key=value olish
|
||||
for kv in "$@"; do
|
||||
local key="${kv%%=*}"
|
||||
local value="${kv#*=}"
|
||||
sudo sed -i "s|^$key=.*|$key=$value|" "$env_file"
|
||||
done
|
||||
}
|
||||
|
||||
# Funksiyani chaqirish misoli
|
||||
update_env \
|
||||
"DJANGO_SECRET_KEY=${{ secrets.KEY }}" \
|
||||
"CACHE_ENABLED=True" \
|
||||
"ALLOWED_HOSTS=127.0.0.1,web,api.gold-eggs.uz" \
|
||||
"CSRF_TRUSTED_ORIGINS=http://127.0.0.1:8081,https://api.gold-eggs.uz" \
|
||||
"SMS_API_URL=${{ secrets.SMS_API_URL }}" \
|
||||
"SMS_LOGIN=${{ secrets.SMS_LOGIN }}" \
|
||||
"SMS_PASSWORD=${{ secrets.SMS_PASSWORD }}"
|
||||
|
||||
sudo docker stack deploy -c stack.yaml ${{ env.PROJECT_NAME }}
|
||||
|
||||
156
.gitignore
vendored
Executable file
156
.gitignore
vendored
Executable file
@@ -0,0 +1,156 @@
|
||||
node_modules
|
||||
|
||||
# OS ignores
|
||||
*.DS_Store
|
||||
|
||||
# Byte-compiled / optimized / DLL files
|
||||
__pycache__/
|
||||
*.py[cod]
|
||||
*$py.class
|
||||
|
||||
poetry.lock
|
||||
|
||||
# C extensions
|
||||
*.so
|
||||
|
||||
# Distribution / packaging
|
||||
.Python
|
||||
build/
|
||||
develop-eggs/
|
||||
dist/
|
||||
downloads/
|
||||
lib/
|
||||
lib64/
|
||||
parts/
|
||||
sdist/
|
||||
var/
|
||||
wheels/
|
||||
share/python-wheels/
|
||||
*.egg-info/
|
||||
.installed.cfg
|
||||
*.egg
|
||||
MANIFEST
|
||||
|
||||
# PyInstaller
|
||||
# Usually these files are written by a python script from a template
|
||||
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
||||
*.manifest
|
||||
*.spec
|
||||
|
||||
# Installer logs
|
||||
pip-log.txt
|
||||
pip-delete-this-directory.txt
|
||||
|
||||
# Unit test / coverage reports
|
||||
htmlcov/
|
||||
.tox/
|
||||
.nox/
|
||||
.coverage
|
||||
.coverage.*
|
||||
.cache
|
||||
nosetests.xml
|
||||
coverage.xml
|
||||
*.cover
|
||||
*.py,cover
|
||||
.hypothesis/
|
||||
.pytest_cache/
|
||||
cover/
|
||||
|
||||
# Translations
|
||||
*.mo
|
||||
*.pot
|
||||
|
||||
# Django stuff:
|
||||
*.log
|
||||
local_settings.py
|
||||
db.sqlite3
|
||||
db.sqlite3-journal
|
||||
|
||||
# Flask stuff:
|
||||
instance/
|
||||
.webassets-cache
|
||||
|
||||
# Scrapy stuff:
|
||||
.scrapy
|
||||
|
||||
# Sphinx documentation
|
||||
docs/_build/
|
||||
|
||||
# PyBuilder
|
||||
.pybuilder/
|
||||
target/
|
||||
|
||||
# Jupyter Notebook
|
||||
.ipynb_checkpoints
|
||||
|
||||
# IPython
|
||||
profile_default/
|
||||
ipython_config.py
|
||||
|
||||
# pyenv
|
||||
# For a library or package, you might want to ignore these files since the code is
|
||||
# intended to run in multiple environments; otherwise, check them in:
|
||||
# .python-version
|
||||
|
||||
# pipenv
|
||||
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
||||
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
||||
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
||||
# install all needed dependencies.
|
||||
#Pipfile.lock
|
||||
|
||||
# poetry
|
||||
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
||||
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
||||
# commonly ignored for libraries.
|
||||
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
||||
#poetry.lock
|
||||
|
||||
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
|
||||
__pypackages__/
|
||||
|
||||
# Celery stuff
|
||||
celerybeat-schedule
|
||||
celerybeat.pid
|
||||
|
||||
# SageMath parsed files
|
||||
*.sage.py
|
||||
|
||||
# Environments
|
||||
.env
|
||||
.venv
|
||||
env/
|
||||
venv/
|
||||
ENV/
|
||||
env.bak/
|
||||
venv.bak/
|
||||
|
||||
# Spyder project settings
|
||||
.spyderproject
|
||||
.spyproject
|
||||
|
||||
# Rope project settings
|
||||
.ropeproject
|
||||
|
||||
# mkdocs documentation
|
||||
/site
|
||||
|
||||
# mypy
|
||||
.mypy_cache/
|
||||
.dmypy.json
|
||||
dmypy.json
|
||||
|
||||
# Pyre type checker
|
||||
.pyre/
|
||||
|
||||
# pytype static type analyzer
|
||||
.pytype/
|
||||
|
||||
# Cython debug symbols
|
||||
cython_debug/
|
||||
|
||||
# PyCharm
|
||||
.idea/
|
||||
|
||||
# Visual Studio Code
|
||||
.vscode
|
||||
22
.gitlab-ci.yml
Normal file
22
.gitlab-ci.yml
Normal file
@@ -0,0 +1,22 @@
|
||||
stages:
|
||||
- deploy
|
||||
|
||||
deploy_django_app:
|
||||
stage: deploy
|
||||
image: ubuntu:latest # Ubuntu tasvirini ishlatish
|
||||
only:
|
||||
- main
|
||||
before_script:
|
||||
- apt-get update && apt-get install -y openssh-client # Ubuntu/Debian uchun to'g'ri paket o'rnatish buyruqlari
|
||||
- eval $(ssh-agent -s)
|
||||
- echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add -
|
||||
- mkdir -p ~/.ssh
|
||||
- echo "$SSH_SERVER_HOSTKEYS" > ~/.ssh/known_hosts
|
||||
script:
|
||||
- ssh $SSH_USER@$SSH_HOST -p $SSH_PORT "
|
||||
cd $DEPLOY_PATH &&
|
||||
git pull origin main &&
|
||||
docker compose up --build -d &&
|
||||
docker image prune -f &&
|
||||
echo 'Deploy jarayoni muvaffaqiyatli yakunlandi!'"
|
||||
|
||||
0
.pre-commit-config.yaml
Normal file
0
.pre-commit-config.yaml
Normal file
23
Dockerfile
Executable file
23
Dockerfile
Executable file
@@ -0,0 +1,23 @@
|
||||
FROM jscorptech/django:latest
|
||||
|
||||
ARG SCRIPT="entrypoint.sh"
|
||||
ENV SCRIPT=$SCRIPT
|
||||
ENV PROMETHEUS_MULTIPROC_DIR=/tmp/prometheus_metrics
|
||||
|
||||
WORKDIR /code
|
||||
|
||||
COPY requirements.txt /code/requirements.txt
|
||||
|
||||
RUN uv pip install -r requirements.txt
|
||||
|
||||
COPY ./ /code
|
||||
|
||||
COPY ./scripts/$SCRIPT /code/$SCRIPT
|
||||
|
||||
RUN chmod +x /code/scripts/$SCRIPT
|
||||
|
||||
RUN mkdir -p /tmp/prometheus_metrics
|
||||
|
||||
CMD sh /code/scripts/$SCRIPT
|
||||
|
||||
|
||||
60
Makefile
Normal file
60
Makefile
Normal file
@@ -0,0 +1,60 @@
|
||||
app ?= web
|
||||
shell ?= bash
|
||||
|
||||
up:
|
||||
docker compose up
|
||||
|
||||
build:
|
||||
docker compose build
|
||||
|
||||
up-b:
|
||||
docker compose up -b
|
||||
|
||||
db:
|
||||
docker compose exec db sh
|
||||
|
||||
restart:
|
||||
docker compose restart $(app)
|
||||
|
||||
collect:
|
||||
docker compose exec web poetry run python manage.py collectstatic
|
||||
|
||||
makemigrations:
|
||||
docker compose exec web poetry run python manage.py makemigrations
|
||||
|
||||
up-d:
|
||||
docker compose up -d
|
||||
|
||||
logging:
|
||||
docker compose logs -f web
|
||||
|
||||
down:
|
||||
docker compose down
|
||||
|
||||
migrate:
|
||||
docker compose exec web poetry run python manage.py migrate
|
||||
|
||||
superuser:
|
||||
docker compose exec web poetry run python manage.py createsuperuser
|
||||
|
||||
shell:
|
||||
@echo "Following logs for: $(app) shell: $(shell)"
|
||||
docker compose exec $(app) $(shell)
|
||||
|
||||
test:
|
||||
docker compose exec web poetry run python manage.py test
|
||||
|
||||
chown:
|
||||
sudo chown -R user:user ./*
|
||||
|
||||
connect:
|
||||
@echo "Following logs for: $(app)"
|
||||
docker compose logs -f $(app)
|
||||
|
||||
pull:
|
||||
git pull
|
||||
|
||||
push:
|
||||
git add . && git commit -m "$(comment)" && git push
|
||||
|
||||
.PHONY: up
|
||||
11
ViteDockerfile
Normal file
11
ViteDockerfile
Normal file
@@ -0,0 +1,11 @@
|
||||
FROM node:20-alpine
|
||||
|
||||
WORKDIR /code
|
||||
|
||||
COPY package*.json ./
|
||||
|
||||
RUN npm install
|
||||
|
||||
COPY . .
|
||||
|
||||
CMD ["sh","./scripts/node.sh"]
|
||||
BIN
celerybeat-schedule-shm
Normal file
BIN
celerybeat-schedule-shm
Normal file
Binary file not shown.
BIN
celerybeat-schedule-wal
Normal file
BIN
celerybeat-schedule-wal
Normal file
Binary file not shown.
23
common/env.py
Executable file
23
common/env.py
Executable file
@@ -0,0 +1,23 @@
|
||||
"""
|
||||
Default value for environ variable
|
||||
"""
|
||||
|
||||
import os
|
||||
import environ
|
||||
|
||||
environ.Env.read_env(os.path.join(".env"))
|
||||
|
||||
env = environ.Env(
|
||||
DEBUG=(bool, False),
|
||||
CACHE_TIME=(int, 180),
|
||||
OTP_EXPIRE_TIME=(int, 2),
|
||||
VITE_LIVE=(bool, False),
|
||||
ALLOWED_HOSTS=(str, "localhost"),
|
||||
CSRF_TRUSTED_ORIGINS=(str, "localhost"),
|
||||
DJANGO_SETTINGS_MODULE=(str, "config.settings.local"),
|
||||
CACHE_TIMEOUT=(int, 120),
|
||||
CACHE_ENABLED=(bool, False),
|
||||
VITE_PORT=(int, 5173),
|
||||
VITE_HOST=(str, "vite"),
|
||||
NGROK_AUTHTOKEN=(str, "TOKEN"),
|
||||
)
|
||||
3
config/__init__.py
Executable file
3
config/__init__.py
Executable file
@@ -0,0 +1,3 @@
|
||||
from .celery import app
|
||||
|
||||
__all__ = ["app"]
|
||||
9
config/asgi.py
Executable file
9
config/asgi.py
Executable file
@@ -0,0 +1,9 @@
|
||||
import os
|
||||
|
||||
from django.core.asgi import get_asgi_application
|
||||
|
||||
from common.env import env
|
||||
|
||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", env("DJANGO_SETTINGS_MODULE"))
|
||||
|
||||
application = get_asgi_application()
|
||||
20
config/celery.py
Executable file
20
config/celery.py
Executable file
@@ -0,0 +1,20 @@
|
||||
"""
|
||||
Celery configurations
|
||||
"""
|
||||
|
||||
from __future__ import absolute_import
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import os
|
||||
import celery
|
||||
from django.conf import settings
|
||||
|
||||
from common.env import env
|
||||
|
||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", env("DJANGO_SETTINGS_MODULE"))
|
||||
|
||||
app = celery.Celery("config")
|
||||
|
||||
app.config_from_object("django.conf:settings", namespace="CELERY")
|
||||
|
||||
app.autodiscover_tasks(lambda: settings.INSTALLED_APPS)
|
||||
8
config/conf/__init__.py
Executable file
8
config/conf/__init__.py
Executable file
@@ -0,0 +1,8 @@
|
||||
from . import apps # noqa
|
||||
from .cache import * # noqa
|
||||
from .ckeditor import * # noqa
|
||||
from .cron import * # noqa
|
||||
from .jazzmin import * # noqa
|
||||
from .jwt import * # noqa
|
||||
from .logs import * # noqa
|
||||
from .rest_framework import * # noqa
|
||||
24
config/conf/apps.py
Normal file
24
config/conf/apps.py
Normal file
@@ -0,0 +1,24 @@
|
||||
#####################
|
||||
# My Settings
|
||||
#####################
|
||||
INSTALLED_APPS = [
|
||||
"rest_framework",
|
||||
"corsheaders",
|
||||
"django_filters",
|
||||
"rosetta",
|
||||
"django_redis",
|
||||
"rest_framework_simplejwt",
|
||||
"drf_yasg",
|
||||
"crispy_forms",
|
||||
"import_export",
|
||||
"django_ckeditor_5",
|
||||
"polymorphic",
|
||||
#####################
|
||||
# My apps
|
||||
#####################
|
||||
"core.apps.home.apps.HomeConfig",
|
||||
"core.http.HttpConfig",
|
||||
"core.apps.accounts.apps.AccountsConfig",
|
||||
"core.console.ConsoleConfig",
|
||||
"core.apps.eggs.apps.EggsConfig",
|
||||
]
|
||||
11
config/conf/cache.py
Executable file
11
config/conf/cache.py
Executable file
@@ -0,0 +1,11 @@
|
||||
from common.env import env
|
||||
|
||||
CACHES = {
|
||||
"default": {
|
||||
"BACKEND": env("CACHE_BACKEND"),
|
||||
"LOCATION": env("REDIS_URL"),
|
||||
"TIMEOUT": env("CACHE_TIMEOUT"),
|
||||
},
|
||||
}
|
||||
|
||||
# CACHE_MIDDLEWARE_SECONDS = env("CACHE_TIMEOUT")
|
||||
147
config/conf/ckeditor.py
Executable file
147
config/conf/ckeditor.py
Executable file
@@ -0,0 +1,147 @@
|
||||
import os
|
||||
from pathlib import Path
|
||||
|
||||
STATIC_URL = "/static/"
|
||||
MEDIA_URL = "/media/"
|
||||
MEDIA_ROOT = os.path.join(Path().parent.parent, "media")
|
||||
|
||||
customColorPalette = [
|
||||
{"color": "hsl(4, 90%, 58%)", "label": "Red"},
|
||||
{"color": "hsl(340, 82%, 52%)", "label": "Pink"},
|
||||
{"color": "hsl(291, 64%, 42%)", "label": "Purple"},
|
||||
{"color": "hsl(262, 52%, 47%)", "label": "Deep Purple"},
|
||||
{"color": "hsl(231, 48%, 48%)", "label": "Indigo"},
|
||||
{"color": "hsl(207, 90%, 54%)", "label": "Blue"},
|
||||
]
|
||||
|
||||
CKEDITOR_5_CONFIGS = {
|
||||
"default": {
|
||||
"toolbar": [
|
||||
"heading",
|
||||
"|",
|
||||
"bold",
|
||||
"italic",
|
||||
"link",
|
||||
"bulletedList",
|
||||
"numberedList",
|
||||
"blockQuote",
|
||||
"imageUpload",
|
||||
],
|
||||
},
|
||||
"extends": {
|
||||
"blockToolbar": [
|
||||
"paragraph",
|
||||
"heading1",
|
||||
"heading2",
|
||||
"heading3",
|
||||
"|",
|
||||
"bulletedList",
|
||||
"numberedList",
|
||||
"|",
|
||||
"blockQuote",
|
||||
],
|
||||
"toolbar": [
|
||||
"heading",
|
||||
"|",
|
||||
"outdent",
|
||||
"indent",
|
||||
"|",
|
||||
"bold",
|
||||
"italic",
|
||||
"link",
|
||||
"underline",
|
||||
"strikethrough",
|
||||
"code",
|
||||
"subscript",
|
||||
"superscript",
|
||||
"highlight",
|
||||
"|",
|
||||
"codeBlock",
|
||||
"sourceEditing",
|
||||
"insertImage",
|
||||
"bulletedList",
|
||||
"numberedList",
|
||||
"todoList",
|
||||
"|",
|
||||
"blockQuote",
|
||||
"imageUpload",
|
||||
"|",
|
||||
"fontSize",
|
||||
"fontFamily",
|
||||
"fontColor",
|
||||
"fontBackgroundColor",
|
||||
"mediaEmbed",
|
||||
"removeFormat",
|
||||
"insertTable",
|
||||
],
|
||||
"image": {
|
||||
"toolbar": [
|
||||
"imageTextAlternative",
|
||||
"|",
|
||||
"imageStyle:alignLeft",
|
||||
"imageStyle:alignRight",
|
||||
"imageStyle:alignCenter",
|
||||
"imageStyle:side",
|
||||
"|",
|
||||
],
|
||||
"styles": [
|
||||
"full",
|
||||
"side",
|
||||
"alignLeft",
|
||||
"alignRight",
|
||||
"alignCenter",
|
||||
],
|
||||
},
|
||||
"table": {
|
||||
"contentToolbar": [
|
||||
"tableColumn",
|
||||
"tableRow",
|
||||
"mergeTableCells",
|
||||
"tableProperties",
|
||||
"tableCellProperties",
|
||||
],
|
||||
"tableProperties": {
|
||||
"borderColors": customColorPalette,
|
||||
"backgroundColors": customColorPalette,
|
||||
},
|
||||
"tableCellProperties": {
|
||||
"borderColors": customColorPalette,
|
||||
"backgroundColors": customColorPalette,
|
||||
},
|
||||
},
|
||||
"heading": {
|
||||
"options": [
|
||||
{
|
||||
"model": "paragraph",
|
||||
"title": "Paragraph",
|
||||
"class": "ck-heading_paragraph",
|
||||
},
|
||||
{
|
||||
"model": "heading1",
|
||||
"view": "h1",
|
||||
"title": "Heading 1",
|
||||
"class": "ck-heading_heading1",
|
||||
},
|
||||
{
|
||||
"model": "heading2",
|
||||
"view": "h2",
|
||||
"title": "Heading 2",
|
||||
"class": "ck-heading_heading2",
|
||||
},
|
||||
{
|
||||
"model": "heading3",
|
||||
"view": "h3",
|
||||
"title": "Heading 3",
|
||||
"class": "ck-heading_heading3",
|
||||
},
|
||||
]
|
||||
},
|
||||
},
|
||||
"list": {
|
||||
"properties": {
|
||||
"styles": "true",
|
||||
"startIndex": "true",
|
||||
"reversed": "true",
|
||||
}
|
||||
},
|
||||
}
|
||||
0
config/conf/cron.py
Executable file
0
config/conf/cron.py
Executable file
127
config/conf/jazzmin.py
Executable file
127
config/conf/jazzmin.py
Executable file
@@ -0,0 +1,127 @@
|
||||
from typing import Any
|
||||
|
||||
JAZZMIN_SETTINGS: dict[str | Any, str | None | Any] = {
|
||||
"site_title": "Felix IT Solution",
|
||||
"site_header": "Felix IT Solution",
|
||||
"site_brand": "Felix IT Solution",
|
||||
"site_logo": "/images/logo.png",
|
||||
"login_logo": None,
|
||||
"login_logo_dark": None,
|
||||
"site_logo_classes": "img-circle",
|
||||
"site_icon": None,
|
||||
"welcome_sign": "Felix IT Solution",
|
||||
"copyright": "Felix IT Solution LLC",
|
||||
"search_model": ["auth.User"],
|
||||
"user_avatar": None,
|
||||
"topmenu_links": [
|
||||
{
|
||||
"name": "Home",
|
||||
"url": "admin:index",
|
||||
"permissions": ["auth.view_user"],
|
||||
},
|
||||
{
|
||||
"name": "Support",
|
||||
"url": "https://github.com/farridav/django-jazzmin/issues",
|
||||
"new_window": True,
|
||||
},
|
||||
{"model": "auth.User"},
|
||||
{"app": "books"},
|
||||
],
|
||||
"usermenu_links": [
|
||||
{
|
||||
"name": "Support",
|
||||
"url": "https://github.com/farridav/django-jazzmin/issues",
|
||||
"new_window": True,
|
||||
},
|
||||
{"model": "auth.user"},
|
||||
],
|
||||
"show_sidebar": True,
|
||||
"navigation_expanded": True,
|
||||
"hide_apps": [],
|
||||
"hide_models": [],
|
||||
"order_with_respect_to": ["auth", "books", "books.author", "books.book"],
|
||||
"custom_links": {
|
||||
"books": [
|
||||
{
|
||||
"name": "Make Messages",
|
||||
"url": "make_messages",
|
||||
"icon": "fas fa-comments",
|
||||
"permissions": ["books.view_book"],
|
||||
}
|
||||
]
|
||||
},
|
||||
"icons": {
|
||||
"http.Comment": "fas fa-comments",
|
||||
"http.FrontendTranslation": "fas fa-globe",
|
||||
"http.Post": "fas fa-bars",
|
||||
"http.User": "fas fa-user",
|
||||
"http.Tags": "fas fa-tag",
|
||||
"http.SmsConfirm": "fas fa-comments",
|
||||
"auth.Group": "fas fa-users",
|
||||
"eggs.Courier": "fas fa-user-tie",
|
||||
"eggs.CourierHistory": "fas fa-history",
|
||||
"eggs.CourierProduct": "fas fa-envelope-open-text",
|
||||
"eggs.Group": "fas fa-users",
|
||||
"eggs.Party": "fas fa-person-booth",
|
||||
"eggs.Product": "fas fa-egg",
|
||||
"eggs.Invoice": "fas fa-envelope-open-text",
|
||||
"eggs.Location": "fas fa-location-arrow",
|
||||
"eggs.Market": "fas fa-store",
|
||||
"eggs.Order": "fas fa-envelope-open-text",
|
||||
"eggs.OrderItems": "fas fa-object-group",
|
||||
"eggs.Broken": "fas fa-trash-alt",
|
||||
"eggs.Debt": "fas fa-hand-holding-usd",
|
||||
"eggs.History": "fas fa-history",
|
||||
"eggs.AllHistory": "fas fa-history",
|
||||
"eggs.AdditionalCost": "fas fa-money-bill-wave",
|
||||
"eggs.Sklad": "fas fa-warehouse",
|
||||
"eggs.Monitoring": "fas fa-chart-line",
|
||||
"eggs.Notification": "fas fa-bell",
|
||||
},
|
||||
"default_icon_parents": "fas fa-chevron-circle-right",
|
||||
"default_icon_children": "fas fa-circle",
|
||||
"related_modal_active": False,
|
||||
"custom_css": "css/jazzmin.css",
|
||||
"custom_js": None,
|
||||
"use_google_fonts_cdn": True,
|
||||
"show_ui_builder": False,
|
||||
"changeform_format": "horizontal_tabs",
|
||||
"changeform_format_overrides": {
|
||||
"auth.user": "collapsible",
|
||||
"auth.group": "vertical_tabs",
|
||||
},
|
||||
"language_chooser": True,
|
||||
}
|
||||
|
||||
JAZZMIN_UI_TWEAKS = {
|
||||
"navbar_small_text": False,
|
||||
"footer_small_text": False,
|
||||
"body_small_text": True,
|
||||
"brand_small_text": False,
|
||||
"brand_colour": "navbar-navy",
|
||||
"accent": "accent-primary",
|
||||
"navbar": "navbar-navy navbar-dark",
|
||||
"no_navbar_border": False,
|
||||
"navbar_fixed": True,
|
||||
"layout_boxed": False,
|
||||
"footer_fixed": False,
|
||||
"sidebar_fixed": True,
|
||||
"sidebar": "sidebar-dark-navy",
|
||||
"sidebar_nav_small_text": False,
|
||||
"sidebar_disable_expand": False,
|
||||
"sidebar_nav_child_indent": False,
|
||||
"sidebar_nav_compact_style": True,
|
||||
"sidebar_nav_legacy_style": False,
|
||||
"sidebar_nav_flat_style": False,
|
||||
"theme": "minty",
|
||||
"dark_mode_theme": None,
|
||||
"button_classes": {
|
||||
"primary": "btn-outline-primary",
|
||||
"secondary": "btn-outline-secondary",
|
||||
"info": "btn-outline-info",
|
||||
"warning": "btn-warning",
|
||||
"danger": "btn-danger",
|
||||
"success": "btn-success",
|
||||
},
|
||||
"actions_sticky_top": False,
|
||||
}
|
||||
37
config/conf/jwt.py
Executable file
37
config/conf/jwt.py
Executable file
@@ -0,0 +1,37 @@
|
||||
from datetime import timedelta
|
||||
|
||||
from common.env import env
|
||||
|
||||
SIMPLE_JWT = {
|
||||
"ACCESS_TOKEN_LIFETIME": timedelta(days=30),
|
||||
"REFRESH_TOKEN_LIFETIME": timedelta(days=365),
|
||||
"ROTATE_REFRESH_TOKENS": False,
|
||||
"BLACKLIST_AFTER_ROTATION": False,
|
||||
"UPDATE_LAST_LOGIN": False,
|
||||
"ALGORITHM": "HS256",
|
||||
"SIGNING_KEY": env("DJANGO_SECRET_KEY"),
|
||||
"VERIFYING_KEY": "",
|
||||
"AUDIENCE": None,
|
||||
"ISSUER": None,
|
||||
"JSON_ENCODER": None,
|
||||
"JWK_URL": None,
|
||||
"LEEWAY": 0,
|
||||
"AUTH_HEADER_TYPES": ("Bearer",),
|
||||
"AUTH_HEADER_NAME": "HTTP_AUTHORIZATION",
|
||||
"USER_ID_FIELD": "id",
|
||||
"USER_ID_CLAIM": "user_id",
|
||||
"USER_AUTHENTICATION_RULE": "rest_framework_simplejwt.authentication.default_user_authentication_rule",
|
||||
"AUTH_TOKEN_CLASSES": ("rest_framework_simplejwt.tokens.AccessToken",),
|
||||
"TOKEN_TYPE_CLAIM": "token_type",
|
||||
"TOKEN_USER_CLASS": "rest_framework_simplejwt.models.TokenUser",
|
||||
"JTI_CLAIM": "jti",
|
||||
"SLIDING_TOKEN_REFRESH_EXP_CLAIM": "refresh_exp",
|
||||
"SLIDING_TOKEN_LIFETIME": timedelta(days=30),
|
||||
"SLIDING_TOKEN_REFRESH_LIFETIME": timedelta(days=365),
|
||||
"TOKEN_OBTAIN_SERIALIZER": "rest_framework_simplejwt.serializers.TokenObtainPairSerializer",
|
||||
"TOKEN_REFRESH_SERIALIZER": "rest_framework_simplejwt.serializers.TokenRefreshSerializer",
|
||||
"TOKEN_VERIFY_SERIALIZER": "rest_framework_simplejwt.serializers.TokenVerifySerializer",
|
||||
"TOKEN_BLACKLIST_SERIALIZER": "rest_framework_simplejwt.serializers.TokenBlacklistSerializer",
|
||||
"SLIDING_TOKEN_OBTAIN_SERIALIZER": "rest_framework_simplejwt.serializers.TokenObtainSlidingSerializer",
|
||||
"SLIDING_TOKEN_REFRESH_SERIALIZER": "rest_framework_simplejwt.serializers.TokenRefreshSlidingSerializer",
|
||||
}
|
||||
7
config/conf/logs.py
Executable file
7
config/conf/logs.py
Executable file
@@ -0,0 +1,7 @@
|
||||
import logging
|
||||
|
||||
logging.basicConfig(
|
||||
filename=f"./logs/django.log",
|
||||
level=logging.DEBUG,
|
||||
format="%(asctime)s - %(levelname)s - %(message)s",
|
||||
)
|
||||
5
config/conf/rest_framework.py
Executable file
5
config/conf/rest_framework.py
Executable file
@@ -0,0 +1,5 @@
|
||||
REST_FRAMEWORK = {
|
||||
"DEFAULT_AUTHENTICATION_CLASSES": (
|
||||
"rest_framework_simplejwt.authentication.JWTAuthentication",
|
||||
),
|
||||
}
|
||||
0
config/settings/__init__.py
Executable file
0
config/settings/__init__.py
Executable file
146
config/settings/common.py
Executable file
146
config/settings/common.py
Executable file
@@ -0,0 +1,146 @@
|
||||
import os # noqa
|
||||
import pathlib
|
||||
|
||||
import firebase_admin
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
from firebase_admin import credentials
|
||||
|
||||
from config.conf import * # noqa
|
||||
|
||||
BASE_DIR = pathlib.Path(__file__).resolve().parent.parent.parent
|
||||
|
||||
SECRET_KEY = env.str("DJANGO_SECRET_KEY")
|
||||
DEBUG = env.str("DEBUG")
|
||||
|
||||
ALLOWED_HOSTS = ["*"]
|
||||
|
||||
INSTALLED_APPS = [
|
||||
# Design admin panel
|
||||
"jazzmin",
|
||||
"django_select2",
|
||||
"modeltranslation",
|
||||
# Default apps
|
||||
"django.contrib.admin",
|
||||
"django.contrib.auth",
|
||||
"django.contrib.contenttypes",
|
||||
"django.contrib.sessions",
|
||||
"django.contrib.messages",
|
||||
"django.contrib.staticfiles",
|
||||
]
|
||||
|
||||
INSTALLED_APPS += apps.INSTALLED_APPS # noqa
|
||||
|
||||
MIDDLEWARE = [
|
||||
"django.middleware.security.SecurityMiddleware",
|
||||
"django.contrib.sessions.middleware.SessionMiddleware",
|
||||
"corsheaders.middleware.CorsMiddleware", # Cors middleware
|
||||
"django.middleware.locale.LocaleMiddleware", # Locale middleware
|
||||
"django.middleware.common.CommonMiddleware",
|
||||
"django.middleware.csrf.CsrfViewMiddleware",
|
||||
"core.middlewares.fcm_token.JWTFCMMiddleware", # FCM Token middleware
|
||||
"django.contrib.auth.middleware.AuthenticationMiddleware",
|
||||
"django.contrib.messages.middleware.MessageMiddleware",
|
||||
"django.middleware.clickjacking.XFrameOptionsMiddleware",
|
||||
]
|
||||
|
||||
ROOT_URLCONF = "routes"
|
||||
|
||||
TEMPLATES = [
|
||||
{
|
||||
"BACKEND": "django.template.backends.django.DjangoTemplates",
|
||||
"DIRS": [os.path.join(BASE_DIR, "resources/templates")],
|
||||
"APP_DIRS": True,
|
||||
"OPTIONS": {
|
||||
"context_processors": [
|
||||
"django.template.context_processors.debug",
|
||||
"django.template.context_processors.request",
|
||||
"django.contrib.auth.context_processors.auth",
|
||||
"django.contrib.messages.context_processors.messages",
|
||||
],
|
||||
},
|
||||
},
|
||||
]
|
||||
|
||||
WSGI_APPLICATION = "config.wsgi.application"
|
||||
|
||||
AUTH_PASSWORD_VALIDATORS = [
|
||||
{
|
||||
"NAME": "django.contrib.auth.password_validation"
|
||||
".UserAttributeSimilarityValidator",
|
||||
},
|
||||
{
|
||||
"NAME": "django.contrib.auth.password_validation"
|
||||
".MinimumLengthValidator",
|
||||
},
|
||||
{
|
||||
"NAME": "django.contrib.auth.password_validation"
|
||||
".CommonPasswordValidator",
|
||||
},
|
||||
{
|
||||
"NAME": "django.contrib.auth.password_validation"
|
||||
".NumericPasswordValidator",
|
||||
},
|
||||
]
|
||||
|
||||
TIME_ZONE = "Asia/Tashkent"
|
||||
USE_I18N = True
|
||||
USE_TZ = True
|
||||
STATIC_URL = "static/"
|
||||
DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField"
|
||||
|
||||
# Date formats
|
||||
##
|
||||
DATE_FORMAT = "d.m.y"
|
||||
TIME_FORMAT = "H:i:s"
|
||||
DATE_INPUT_FORMATS = ["%d.%m.%Y", "%Y.%d.%m", "%Y.%d.%m"]
|
||||
|
||||
FACTORYS = [
|
||||
("core.http.database.factory.PostFactory", 100000),
|
||||
# ("core.http.database.factory.UserFactory", 1),
|
||||
]
|
||||
|
||||
SEEDERS = ["core.http.database.seeder.UserSeeder"]
|
||||
|
||||
STATICFILES_DIRS = [
|
||||
os.path.join(BASE_DIR, "resources/static"),
|
||||
]
|
||||
|
||||
CORS_ORIGIN_ALLOW_ALL = True
|
||||
|
||||
PAYCOM_SETTINGS = {
|
||||
"KASSA_ID": "1111",
|
||||
"ACCOUNTS": {
|
||||
"KEY": "1234",
|
||||
},
|
||||
"TOKEN": "1111",
|
||||
}
|
||||
|
||||
STATIC_ROOT = os.path.join(BASE_DIR, "resources/staticfiles")
|
||||
VITE_APP_DIR = os.path.join(BASE_DIR, "resources/static/vite")
|
||||
|
||||
LANGUAGES = (
|
||||
("ru", _("Russia")),
|
||||
("en", _("English")),
|
||||
("uz", _("Uzbek")),
|
||||
)
|
||||
LOCALE_PATHS = [os.path.join(BASE_DIR, "locale")]
|
||||
|
||||
MODELTRANSLATION_LANGUAGES = ("uz", "ru", "en")
|
||||
MODELTRANSLATION_DEFAULT_LANGUAGE = "uz"
|
||||
LANGUAGE_CODE = "uz"
|
||||
|
||||
MEDIA_ROOT = os.path.join(BASE_DIR, "media") # Media files
|
||||
MEDIA_URL = "/media/"
|
||||
|
||||
AUTH_USER_MODEL = "http.User"
|
||||
|
||||
CELERY_BROKER_URL = env("REDIS_URL")
|
||||
CELERY_RESULT_BACKEND = env("REDIS_URL")
|
||||
|
||||
CRISPY_TEMPLATE_PACK = "tailwind"
|
||||
|
||||
ALLOWED_HOSTS += env("ALLOWED_HOSTS").split(",")
|
||||
CSRF_TRUSTED_ORIGINS = env("CSRF_TRUSTED_ORIGINS").split(",")
|
||||
|
||||
cred = credentials.Certificate("resources/firebase_golden.json")
|
||||
firebase_admin.initialize_app(cred)
|
||||
47
config/settings/local.py
Executable file
47
config/settings/local.py
Executable file
@@ -0,0 +1,47 @@
|
||||
import core.apps.accounts.apps
|
||||
from common.env import env
|
||||
from config.conf import rest_framework
|
||||
from config.settings.common import * # noqa
|
||||
|
||||
DATABASES = {
|
||||
"default": {
|
||||
"ENGINE": env.str("DB_ENGINE"),
|
||||
"NAME": env.str("DB_NAME"),
|
||||
"USER": env.str("DB_USER"),
|
||||
"PASSWORD": env.str("DB_PASSWORD"),
|
||||
"HOST": env.str("DB_HOST"),
|
||||
"PORT": env.str("DB_PORT"),
|
||||
}
|
||||
}
|
||||
|
||||
MIDDLEWARE += [
|
||||
"debug_toolbar.middleware.DebugToolbarMiddleware",
|
||||
"core.middlewares.ExceptionMiddleware",
|
||||
]
|
||||
|
||||
# Debug toolbar middleware
|
||||
DEBUG_TOOLBAR_PANELS = [
|
||||
"debug_toolbar.panels.versions.VersionsPanel",
|
||||
"debug_toolbar.panels.timer.TimerPanel",
|
||||
"debug_toolbar.panels.settings.SettingsPanel",
|
||||
"debug_toolbar.panels.headers.HeadersPanel",
|
||||
"debug_toolbar.panels.request.RequestPanel",
|
||||
"debug_toolbar.panels.sql.SQLPanel",
|
||||
"debug_toolbar.panels.staticfiles.StaticFilesPanel",
|
||||
"debug_toolbar.panels.templates.TemplatesPanel",
|
||||
"debug_toolbar.panels.cache.CachePanel",
|
||||
"debug_toolbar.panels.signals.SignalsPanel",
|
||||
"debug_toolbar.panels.logging.LoggingPanel",
|
||||
"debug_toolbar.panels.redirects.RedirectsPanel",
|
||||
]
|
||||
|
||||
INTERNAL_IPS = ("127.0.0.1",)
|
||||
|
||||
INSTALLED_APPS += ["debug_toolbar", "django_extensions"]
|
||||
|
||||
# Allowed Hosts
|
||||
ALLOWED_HOSTS += ["127.0.0.1", "192.168.100.26"]
|
||||
|
||||
rest_framework.REST_FRAMEWORK["DEFAULT_THROTTLE_RATES"] = {
|
||||
"user": "10/min",
|
||||
}
|
||||
22
config/settings/production.py
Executable file
22
config/settings/production.py
Executable file
@@ -0,0 +1,22 @@
|
||||
from common.env import env
|
||||
from config.conf import rest_framework
|
||||
from config.settings.common import * # noqa
|
||||
|
||||
DATABASES = {
|
||||
"default": {
|
||||
"ENGINE": env("DB_ENGINE"),
|
||||
"NAME": env("DB_NAME"),
|
||||
"USER": env("DB_USER"),
|
||||
"PASSWORD": env("DB_PASSWORD"),
|
||||
"HOST": env("DB_HOST"),
|
||||
"PORT": env("DB_PORT"),
|
||||
}
|
||||
}
|
||||
|
||||
MIDDLEWARE += []
|
||||
|
||||
ALLOWED_HOSTS += ["192.168.100.26", "80.90.178.156"]
|
||||
|
||||
rest_framework.REST_FRAMEWORK["DEFAULT_THROTTLE_RATES"] = {
|
||||
"user": "10/min",
|
||||
}
|
||||
9
config/wsgi.py
Executable file
9
config/wsgi.py
Executable file
@@ -0,0 +1,9 @@
|
||||
import os
|
||||
|
||||
from django.core.wsgi import get_wsgi_application
|
||||
|
||||
from common.env import env
|
||||
|
||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", env("DJANGO_SETTINGS_MODULE"))
|
||||
|
||||
application = get_wsgi_application()
|
||||
0
core/apps/accounts/__init__.py
Normal file
0
core/apps/accounts/__init__.py
Normal file
0
core/apps/accounts/admin/__init__.py
Normal file
0
core/apps/accounts/admin/__init__.py
Normal file
6
core/apps/accounts/apps.py
Normal file
6
core/apps/accounts/apps.py
Normal file
@@ -0,0 +1,6 @@
|
||||
from django.apps import AppConfig
|
||||
|
||||
|
||||
class AccountsConfig(AppConfig):
|
||||
default_auto_field = "django.db.models.BigAutoField"
|
||||
name = "core.apps.accounts"
|
||||
0
core/apps/accounts/migrations/__init__.py
Normal file
0
core/apps/accounts/migrations/__init__.py
Normal file
0
core/apps/accounts/models/__init__.py
Normal file
0
core/apps/accounts/models/__init__.py
Normal file
1
core/apps/accounts/serializers/__init__.py
Normal file
1
core/apps/accounts/serializers/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
from .check_password import * # noqa
|
||||
6
core/apps/accounts/serializers/check_password.py
Normal file
6
core/apps/accounts/serializers/check_password.py
Normal file
@@ -0,0 +1,6 @@
|
||||
from rest_framework import serializers
|
||||
|
||||
|
||||
class ChangePasswordSerializer(serializers.Serializer):
|
||||
old_password = serializers.CharField(required=True)
|
||||
new_password = serializers.CharField(required=True)
|
||||
0
core/apps/accounts/test/__init__.py
Normal file
0
core/apps/accounts/test/__init__.py
Normal file
64
core/apps/accounts/urls.py
Executable file
64
core/apps/accounts/urls.py
Executable file
@@ -0,0 +1,64 @@
|
||||
"""
|
||||
Accounts app urls
|
||||
"""
|
||||
|
||||
from django.urls import path
|
||||
from rest_framework_simplejwt import views as jwt_views
|
||||
|
||||
from core.apps.accounts import views
|
||||
from core.http.views.user import UserAvatarUpdateView, UserUpdateView
|
||||
|
||||
urlpatterns = [
|
||||
path(
|
||||
"auth/token/",
|
||||
jwt_views.TokenObtainPairView.as_view(),
|
||||
name="token_obtain_pair",
|
||||
), # Login view # noqa
|
||||
path(
|
||||
"auth/token/refresh/",
|
||||
jwt_views.TokenRefreshView.as_view(),
|
||||
name="token_refresh",
|
||||
), # Refresh token view # noqa
|
||||
path(
|
||||
"auth/token/verify/",
|
||||
jwt_views.TokenVerifyView.as_view(),
|
||||
name="token_verify",
|
||||
), # Verify token # noqa
|
||||
# path(
|
||||
# "auth/register/", views.RegisterView.as_view(), name="register"
|
||||
# ), # Register # noqa
|
||||
path(
|
||||
"auth/confirm/", views.ConfirmView.as_view(), name="confirm"
|
||||
), # Confirm Otp code view # noqa
|
||||
path(
|
||||
"auth/reset/password/",
|
||||
views.ResetPasswordView.as_view(),
|
||||
name="reset-password",
|
||||
), # Reset password step 1 # noqa
|
||||
path(
|
||||
"auth/confirm/reset/",
|
||||
views.ResetConfirmationCodeView.as_view(),
|
||||
name="reset-confirmation-code",
|
||||
), # noqa
|
||||
# Reset password step 2
|
||||
path(
|
||||
"auth/resend/", views.ResendView.as_view(), name="resend"
|
||||
), # resend otp code # noqa
|
||||
path(
|
||||
"auth/me/", views.MeView.as_view(), name="me"
|
||||
), # get user information # noqa
|
||||
path(
|
||||
"change/password/",
|
||||
views.ChangePasswordView.as_view(),
|
||||
name="avatar-update",
|
||||
), # chamge user password # noqa
|
||||
# Update user information
|
||||
path(
|
||||
"auth/update/", UserUpdateView.as_view(), name="update"
|
||||
), # update user information # noqa
|
||||
path(
|
||||
"auth/avatar/update/",
|
||||
UserAvatarUpdateView.as_view(),
|
||||
name="avatar-update",
|
||||
), # update user avatar # noqa
|
||||
]
|
||||
2
core/apps/accounts/views/__init__.py
Normal file
2
core/apps/accounts/views/__init__.py
Normal file
@@ -0,0 +1,2 @@
|
||||
from .check_passeord import * # noqa
|
||||
from .sms import * # noqa
|
||||
35
core/apps/accounts/views/check_passeord.py
Normal file
35
core/apps/accounts/views/check_passeord.py
Normal file
@@ -0,0 +1,35 @@
|
||||
from django.contrib.auth.hashers import make_password
|
||||
from rest_framework import exceptions, permissions, status, views
|
||||
from rest_framework.generics import get_object_or_404
|
||||
|
||||
from core.http import views as http_views
|
||||
from core.http.models import User
|
||||
|
||||
from ..serializers import ChangePasswordSerializer
|
||||
|
||||
|
||||
class ChangePasswordView(views.APIView, http_views.ApiResponse):
|
||||
permission_classes = (permissions.IsAuthenticated,)
|
||||
|
||||
def post(self, request, *args, **kwargs):
|
||||
user = request.user
|
||||
|
||||
if user is None:
|
||||
raise exceptions.ValidationError(
|
||||
{"status": False, "message": "Foydalanuvchi topilmadi"}
|
||||
)
|
||||
serializer = ChangePasswordSerializer(data=request.data)
|
||||
if serializer.is_valid():
|
||||
if user.check_password(request.data["old_password"]):
|
||||
user.password = make_password(serializer.data["new_password"])
|
||||
user.save()
|
||||
return http_views.ApiResponse().success(
|
||||
"Parol muvaffaqiyatli o'zgartirildi",
|
||||
status_code=status.HTTP_200_OK,
|
||||
)
|
||||
return http_views.ApiResponse().error(
|
||||
"Noto'g'ri eski parol", status_code=status.HTTP_400_BAD_REQUEST
|
||||
)
|
||||
return http_views.ApiResponse().error(
|
||||
serializer.errors, status_code=status.HTTP_400_BAD_REQUEST
|
||||
)
|
||||
146
core/apps/accounts/views/sms.py
Normal file
146
core/apps/accounts/views/sms.py
Normal file
@@ -0,0 +1,146 @@
|
||||
"""
|
||||
SMS configuration (eskiz.uz)
|
||||
"""
|
||||
|
||||
import typing
|
||||
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
from rest_framework import permissions
|
||||
from rest_framework import request as rest_request
|
||||
from rest_framework import throttling, views
|
||||
|
||||
from core import enums, exceptions, services, utils
|
||||
from core.http import serializers
|
||||
from core.http import views as http_views
|
||||
from core.http.models import User
|
||||
|
||||
|
||||
class RegisterView(
|
||||
views.APIView, services.UserService, http_views.ApiResponse
|
||||
):
|
||||
"""
|
||||
Register new user
|
||||
"""
|
||||
|
||||
serializer_class = serializers.RegisterSerializer
|
||||
throttle_classes = [throttling.UserRateThrottle]
|
||||
|
||||
def post(self, request: rest_request.Request):
|
||||
ser = self.serializer_class(data=request.data)
|
||||
ser.is_valid(raise_exception=True)
|
||||
data = ser.data
|
||||
phone = data.get("phone")
|
||||
|
||||
# Create pending user
|
||||
self.create_user(
|
||||
phone,
|
||||
data.get("first_name"),
|
||||
data.get("last_name"),
|
||||
data.get("password"),
|
||||
)
|
||||
|
||||
# Send confirmation code for sms eskiz.uz
|
||||
self.send_confirmation(phone)
|
||||
return self.success(_(enums.Messages.SEND_MESSAGE) % {"phone": phone})
|
||||
|
||||
|
||||
class ConfirmView(views.APIView, services.UserService, http_views.ApiResponse):
|
||||
"""Confirm otp code"""
|
||||
|
||||
serializer_class = serializers.ConfirmSerializer
|
||||
|
||||
def post(self, request: rest_request.Request):
|
||||
ser = self.serializer_class(data=request.data)
|
||||
ser.is_valid(raise_exception=True)
|
||||
|
||||
data = ser.data
|
||||
phone, code = data.get("phone"), data.get("code")
|
||||
|
||||
try:
|
||||
# Check Sms confirmation otp code
|
||||
if services.SmsService.check_confirm(phone, code=code):
|
||||
# Create user
|
||||
token = self.validate_user(
|
||||
User.objects.filter(phone=phone).first()
|
||||
)
|
||||
return self.success(
|
||||
_(enums.Messages.OTP_CONFIRMED), token=token
|
||||
)
|
||||
except exceptions.SmsException as e:
|
||||
return utils.ResponseException(e)
|
||||
except Exception as e:
|
||||
return self.error(e)
|
||||
|
||||
|
||||
class ResetConfirmationCodeView(
|
||||
views.APIView, http_views.ApiResponse, services.UserService
|
||||
): # noqa
|
||||
"""
|
||||
Reset confirm otp code
|
||||
"""
|
||||
|
||||
serializer_class = serializers.ResetConfirmationSerializer
|
||||
|
||||
def post(self, request: rest_request.Request):
|
||||
ser = self.serializer_class(data=request.data)
|
||||
ser.is_valid(raise_exception=True)
|
||||
|
||||
data = ser.data
|
||||
code, phone, password = (
|
||||
data.get("code"),
|
||||
data.get("phone"),
|
||||
data.get("password"),
|
||||
) # noqa
|
||||
|
||||
try:
|
||||
res = services.SmsService.check_confirm(phone, code)
|
||||
if res:
|
||||
self.change_password(phone, password)
|
||||
return self.success(_(enums.Messages.CHANGED_PASSWORD))
|
||||
return self.error(_(enums.Messages.INVALID_OTP))
|
||||
except exceptions.SmsException as e:
|
||||
return self.error(e, error_code=enums.Codes.INVALID_OTP_ERROR)
|
||||
except Exception as e:
|
||||
return self.error(e)
|
||||
|
||||
|
||||
class ResendView(http_views.AbstractSendSms):
|
||||
"""
|
||||
Resend Otp Code
|
||||
"""
|
||||
|
||||
serializer_class = serializers.ResendSerializer
|
||||
|
||||
|
||||
class ResetPasswordView(http_views.AbstractSendSms):
|
||||
"""
|
||||
Reset user password
|
||||
"""
|
||||
|
||||
serializer_class: typing.Type[serializers.ResetPasswordSerializer] = (
|
||||
serializers.ResetPasswordSerializer
|
||||
) # noqa
|
||||
|
||||
|
||||
# class MeView(views.APIView, http_views.ApiResponse):
|
||||
# """
|
||||
# Get user information
|
||||
# """
|
||||
# permission_classes = [permissions.IsAuthenticated]
|
||||
#
|
||||
# def get(self, request: rest_request.Request):
|
||||
# user = request.user
|
||||
# serializer = serializers.UserSerializer(user, context={'request': request})
|
||||
# return self.success(data=serializer.data)
|
||||
|
||||
|
||||
class MeView(views.APIView, http_views.ApiResponse):
|
||||
"""
|
||||
Get user information
|
||||
"""
|
||||
|
||||
permission_classes = [permissions.IsAuthenticated]
|
||||
|
||||
def get(self, request: rest_request.Request):
|
||||
user = request.user
|
||||
return self.success(data=serializers.UserSerializer(user).data)
|
||||
0
core/apps/eggs/__init__.py
Normal file
0
core/apps/eggs/__init__.py
Normal file
211
core/apps/eggs/admin.py
Normal file
211
core/apps/eggs/admin.py
Normal file
@@ -0,0 +1,211 @@
|
||||
"""
|
||||
Dajngo admin panel models register
|
||||
"""
|
||||
|
||||
from django.contrib import admin
|
||||
|
||||
from core.apps.eggs import models
|
||||
from core.apps.eggs.models.notification import Notification
|
||||
|
||||
|
||||
@admin.register(models.Courier)
|
||||
class CourierAdmin(admin.ModelAdmin):
|
||||
list_display = ["id", "user_id", "courier_name"]
|
||||
|
||||
def courier_name(self, obj):
|
||||
return f"{obj.user_id.first_name} {obj.user_id.last_name}"
|
||||
|
||||
|
||||
@admin.register(models.CourierProduct)
|
||||
class CourierProductAdmin(admin.ModelAdmin):
|
||||
list_display = [
|
||||
"id",
|
||||
"courier_id",
|
||||
"group_id",
|
||||
"count",
|
||||
"return_eggs",
|
||||
"created_at",
|
||||
]
|
||||
|
||||
|
||||
@admin.register(models.CourierHistory)
|
||||
class CourierHistoryAdmin(admin.ModelAdmin):
|
||||
list_display = [
|
||||
"id",
|
||||
"courier_id",
|
||||
"group_id",
|
||||
"get_eggs",
|
||||
"return_eggs",
|
||||
"broken_eggs",
|
||||
"date",
|
||||
"courier_product_id",
|
||||
]
|
||||
|
||||
|
||||
@admin.register(models.Group)
|
||||
class GroupAdmin(admin.ModelAdmin):
|
||||
list_display = [
|
||||
"id",
|
||||
"product_id",
|
||||
"party_id",
|
||||
"entry_price",
|
||||
"unit_price",
|
||||
"wholesale_price",
|
||||
"quantity",
|
||||
"broken_eggs",
|
||||
]
|
||||
|
||||
|
||||
@admin.register(models.Invoice)
|
||||
class InvoiceAdmin(admin.ModelAdmin):
|
||||
list_display = ["id", "name", "price", "party_id"]
|
||||
|
||||
|
||||
@admin.register(models.Location)
|
||||
class LocationAdmin(admin.ModelAdmin):
|
||||
list_display = ["id", "long", "lat", "label"]
|
||||
|
||||
|
||||
@admin.register(models.Market)
|
||||
class MarketAdmin(admin.ModelAdmin):
|
||||
list_display = [
|
||||
"id",
|
||||
"name",
|
||||
"company_name",
|
||||
"user_id",
|
||||
"phone",
|
||||
"debt_paid",
|
||||
"debt_unpaid",
|
||||
]
|
||||
|
||||
|
||||
@admin.register(models.Order)
|
||||
class OrderAdmin(admin.ModelAdmin):
|
||||
list_display = [
|
||||
"id",
|
||||
"courier_id",
|
||||
"market_id",
|
||||
"data",
|
||||
"status",
|
||||
"price",
|
||||
"price_paid",
|
||||
"debt",
|
||||
]
|
||||
|
||||
|
||||
@admin.register(models.OrderItems)
|
||||
class OrderItemsAdmin(admin.ModelAdmin):
|
||||
list_display = [
|
||||
"id",
|
||||
"group_id",
|
||||
"count",
|
||||
"discount",
|
||||
"courier_product_id",
|
||||
"order_id",
|
||||
"sale_type",
|
||||
]
|
||||
|
||||
|
||||
@admin.register(models.Party)
|
||||
class PartAdmin(admin.ModelAdmin):
|
||||
list_display = [
|
||||
"id",
|
||||
"user_id",
|
||||
"count",
|
||||
"sold_count",
|
||||
"remaining_count",
|
||||
"benefit",
|
||||
"cost",
|
||||
"total_cost",
|
||||
]
|
||||
|
||||
|
||||
@admin.register(models.Product)
|
||||
class ProductAdmin(admin.ModelAdmin):
|
||||
list_display = ["id", "name"]
|
||||
|
||||
|
||||
@admin.register(models.Broken)
|
||||
class BrokenAdmin(admin.ModelAdmin):
|
||||
list_display = ["id", "group", "comment", "quantity", "user"]
|
||||
|
||||
def user(self, obj):
|
||||
return f"{obj.user_id.first_name} {obj.user_id.last_name}"
|
||||
|
||||
|
||||
@admin.register(models.Debt)
|
||||
class DebtAdmin(admin.ModelAdmin):
|
||||
list_display = ["id", "market", "debt_price"]
|
||||
|
||||
|
||||
@admin.register(models.History)
|
||||
class HistoryAdmin(admin.ModelAdmin):
|
||||
list_display = [
|
||||
"id",
|
||||
"content_type",
|
||||
"object_id",
|
||||
"action",
|
||||
"timestamp",
|
||||
"created_by",
|
||||
"created_who",
|
||||
"reason",
|
||||
"comment",
|
||||
]
|
||||
|
||||
|
||||
# @admin.register(models.AllHistory)
|
||||
# class AllHistoryAdmin(admin.ModelAdmin):
|
||||
# list_display = [
|
||||
# "id",
|
||||
# "content_type",
|
||||
# "object_id",
|
||||
# "action",
|
||||
# "timestamp",
|
||||
# "created_by",
|
||||
# "created_who",
|
||||
# "reason",
|
||||
# ]
|
||||
|
||||
|
||||
@admin.register(models.AdditionalCost)
|
||||
class AdditionalCostAdmin(admin.ModelAdmin):
|
||||
list_display = ["id", "user", "reason", "price", "created_at"]
|
||||
readonly_fields = ["created_at"]
|
||||
|
||||
def user(self, obj):
|
||||
return f"{obj.user.first_name} {obj.user.last_name}"
|
||||
|
||||
|
||||
@admin.register(models.Sklad)
|
||||
class SkladAdmin(admin.ModelAdmin):
|
||||
list_display = ["id", "user_id"]
|
||||
|
||||
def user_id(self, obj):
|
||||
return f"{obj.user_id.first_name} {obj.user_id.last_name}"
|
||||
|
||||
|
||||
@admin.register(models.Monitoring)
|
||||
class MonitoringAdmin(admin.ModelAdmin):
|
||||
list_display = [
|
||||
"id",
|
||||
"content_type",
|
||||
"object_id",
|
||||
"action",
|
||||
"timestamp",
|
||||
"created_by",
|
||||
"created_who",
|
||||
"reason",
|
||||
"comment",
|
||||
"price",
|
||||
]
|
||||
|
||||
|
||||
@admin.register(Notification)
|
||||
class NotificationAdmin(admin.ModelAdmin):
|
||||
list_display = ("title", "body", "user", "is_read", "is_sending")
|
||||
|
||||
|
||||
@admin.register(models.DailyCost)
|
||||
class DailyCostAdmin(admin.ModelAdmin):
|
||||
list_display = ["id", "first_cost", "second_cost", "third_cost", "created_at"]
|
||||
readonly_fields = ["created_at"]
|
||||
9
core/apps/eggs/apps.py
Normal file
9
core/apps/eggs/apps.py
Normal file
@@ -0,0 +1,9 @@
|
||||
from django.apps import AppConfig
|
||||
|
||||
|
||||
class EggsConfig(AppConfig):
|
||||
default_auto_field = "django.db.models.BigAutoField"
|
||||
name = "core.apps.eggs"
|
||||
|
||||
def ready(self) -> None:
|
||||
from core.apps.eggs import utils # noqa
|
||||
435
core/apps/eggs/migrations/0001_initial.py
Normal file
435
core/apps/eggs/migrations/0001_initial.py
Normal file
@@ -0,0 +1,435 @@
|
||||
# Generated by Django 5.0.4 on 2024-04-23 08:54
|
||||
|
||||
import django.db.models.deletion
|
||||
from django.conf import settings
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
initial = True
|
||||
|
||||
dependencies = [
|
||||
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name="Group",
|
||||
fields=[
|
||||
(
|
||||
"id",
|
||||
models.BigAutoField(
|
||||
auto_created=True,
|
||||
primary_key=True,
|
||||
serialize=False,
|
||||
verbose_name="ID",
|
||||
),
|
||||
),
|
||||
("created_at", models.DateTimeField(auto_now_add=True)),
|
||||
("updated_at", models.DateTimeField(auto_now=True)),
|
||||
(
|
||||
"entry_price",
|
||||
models.DecimalField(decimal_places=2, max_digits=10),
|
||||
),
|
||||
(
|
||||
"unit_price",
|
||||
models.DecimalField(decimal_places=2, max_digits=10),
|
||||
),
|
||||
(
|
||||
"wholesale_price",
|
||||
models.DecimalField(decimal_places=2, max_digits=10),
|
||||
),
|
||||
("quantity", models.IntegerField()),
|
||||
("broken_eggs", models.IntegerField()),
|
||||
],
|
||||
options={
|
||||
"verbose_name": "Group",
|
||||
"verbose_name_plural": "Groups",
|
||||
"db_table": "group",
|
||||
},
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name="Location",
|
||||
fields=[
|
||||
(
|
||||
"id",
|
||||
models.BigAutoField(
|
||||
auto_created=True,
|
||||
primary_key=True,
|
||||
serialize=False,
|
||||
verbose_name="ID",
|
||||
),
|
||||
),
|
||||
("created_at", models.DateTimeField(auto_now_add=True)),
|
||||
("updated_at", models.DateTimeField(auto_now=True)),
|
||||
("long", models.BigIntegerField()),
|
||||
("lat", models.BigIntegerField()),
|
||||
("label", models.TextField()),
|
||||
],
|
||||
options={
|
||||
"verbose_name": "Location",
|
||||
"verbose_name_plural": "Locations",
|
||||
"db_table": "location",
|
||||
},
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name="Product",
|
||||
fields=[
|
||||
(
|
||||
"id",
|
||||
models.BigAutoField(
|
||||
auto_created=True,
|
||||
primary_key=True,
|
||||
serialize=False,
|
||||
verbose_name="ID",
|
||||
),
|
||||
),
|
||||
("created_at", models.DateTimeField(auto_now_add=True)),
|
||||
("updated_at", models.DateTimeField(auto_now=True)),
|
||||
("name", models.CharField(max_length=255)),
|
||||
],
|
||||
options={
|
||||
"verbose_name": "Product",
|
||||
"verbose_name_plural": "Products",
|
||||
"db_table": "product",
|
||||
},
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name="Courier",
|
||||
fields=[
|
||||
(
|
||||
"id",
|
||||
models.BigAutoField(
|
||||
auto_created=True,
|
||||
primary_key=True,
|
||||
serialize=False,
|
||||
verbose_name="ID",
|
||||
),
|
||||
),
|
||||
("created_at", models.DateTimeField(auto_now_add=True)),
|
||||
("updated_at", models.DateTimeField(auto_now=True)),
|
||||
(
|
||||
"user_id",
|
||||
models.ForeignKey(
|
||||
on_delete=django.db.models.deletion.CASCADE,
|
||||
related_name="couriers",
|
||||
to=settings.AUTH_USER_MODEL,
|
||||
),
|
||||
),
|
||||
],
|
||||
options={
|
||||
"verbose_name": "Courier",
|
||||
"verbose_name_plural": "Couriers",
|
||||
"db_table": "courier",
|
||||
},
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name="CourierProduct",
|
||||
fields=[
|
||||
(
|
||||
"id",
|
||||
models.BigAutoField(
|
||||
auto_created=True,
|
||||
primary_key=True,
|
||||
serialize=False,
|
||||
verbose_name="ID",
|
||||
),
|
||||
),
|
||||
("created_at", models.DateTimeField(auto_now_add=True)),
|
||||
("updated_at", models.DateTimeField(auto_now=True)),
|
||||
("count", models.IntegerField()),
|
||||
(
|
||||
"courier_id",
|
||||
models.ForeignKey(
|
||||
on_delete=django.db.models.deletion.CASCADE,
|
||||
related_name="courier_products",
|
||||
to="eggs.courier",
|
||||
),
|
||||
),
|
||||
(
|
||||
"group_id",
|
||||
models.ForeignKey(
|
||||
on_delete=django.db.models.deletion.CASCADE,
|
||||
related_name="courier_groups",
|
||||
to="eggs.group",
|
||||
),
|
||||
),
|
||||
],
|
||||
options={
|
||||
"verbose_name": "CourierProduct",
|
||||
"verbose_name_plural": "CourierProducts",
|
||||
"db_table": "courier_product",
|
||||
},
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name="Market",
|
||||
fields=[
|
||||
(
|
||||
"id",
|
||||
models.BigAutoField(
|
||||
auto_created=True,
|
||||
primary_key=True,
|
||||
serialize=False,
|
||||
verbose_name="ID",
|
||||
),
|
||||
),
|
||||
("created_at", models.DateTimeField(auto_now_add=True)),
|
||||
("updated_at", models.DateTimeField(auto_now=True)),
|
||||
("name", models.CharField(max_length=255)),
|
||||
(
|
||||
"avatar",
|
||||
models.ImageField(
|
||||
blank=True, null=True, upload_to="market_avatar/"
|
||||
),
|
||||
),
|
||||
("phone", models.CharField(max_length=20)),
|
||||
(
|
||||
"location",
|
||||
models.ForeignKey(
|
||||
on_delete=django.db.models.deletion.CASCADE,
|
||||
related_name="market_location",
|
||||
to="eggs.location",
|
||||
),
|
||||
),
|
||||
(
|
||||
"user_id",
|
||||
models.ForeignKey(
|
||||
on_delete=django.db.models.deletion.CASCADE,
|
||||
to=settings.AUTH_USER_MODEL,
|
||||
),
|
||||
),
|
||||
],
|
||||
options={
|
||||
"verbose_name": "Market",
|
||||
"verbose_name_plural": "Markets",
|
||||
"db_table": "market",
|
||||
},
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name="Order",
|
||||
fields=[
|
||||
(
|
||||
"id",
|
||||
models.BigAutoField(
|
||||
auto_created=True,
|
||||
primary_key=True,
|
||||
serialize=False,
|
||||
verbose_name="ID",
|
||||
),
|
||||
),
|
||||
("created_at", models.DateTimeField(auto_now_add=True)),
|
||||
("updated_at", models.DateTimeField(auto_now=True)),
|
||||
("data", models.DateField(auto_now=True)),
|
||||
(
|
||||
"status",
|
||||
models.CharField(
|
||||
choices=[
|
||||
("delivery", "Delivery"),
|
||||
("pending", "Pending"),
|
||||
("success", "Success"),
|
||||
("cancel", "Cancel"),
|
||||
("done", "Done"),
|
||||
],
|
||||
default="pending",
|
||||
max_length=255,
|
||||
),
|
||||
),
|
||||
("comment", models.TextField(blank=True, null=True)),
|
||||
(
|
||||
"price",
|
||||
models.DecimalField(decimal_places=2, max_digits=10),
|
||||
),
|
||||
(
|
||||
"price_paid",
|
||||
models.DecimalField(decimal_places=2, max_digits=10),
|
||||
),
|
||||
(
|
||||
"courier_id",
|
||||
models.ForeignKey(
|
||||
on_delete=django.db.models.deletion.CASCADE,
|
||||
related_name="orders",
|
||||
to="eggs.courier",
|
||||
),
|
||||
),
|
||||
(
|
||||
"location_id",
|
||||
models.ForeignKey(
|
||||
on_delete=django.db.models.deletion.CASCADE,
|
||||
to="eggs.location",
|
||||
),
|
||||
),
|
||||
(
|
||||
"market_id",
|
||||
models.ForeignKey(
|
||||
on_delete=django.db.models.deletion.CASCADE,
|
||||
related_name="orders",
|
||||
to="eggs.market",
|
||||
),
|
||||
),
|
||||
],
|
||||
options={
|
||||
"verbose_name": "Order",
|
||||
"verbose_name_plural": "Orders",
|
||||
"db_table": "order",
|
||||
},
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name="Party",
|
||||
fields=[
|
||||
(
|
||||
"id",
|
||||
models.BigAutoField(
|
||||
auto_created=True,
|
||||
primary_key=True,
|
||||
serialize=False,
|
||||
verbose_name="ID",
|
||||
),
|
||||
),
|
||||
("created_at", models.DateTimeField(auto_now_add=True)),
|
||||
("updated_at", models.DateTimeField(auto_now=True)),
|
||||
(
|
||||
"price",
|
||||
models.DecimalField(decimal_places=2, max_digits=10),
|
||||
),
|
||||
(
|
||||
"user_id",
|
||||
models.ForeignKey(
|
||||
on_delete=django.db.models.deletion.CASCADE,
|
||||
related_name="parties",
|
||||
to=settings.AUTH_USER_MODEL,
|
||||
),
|
||||
),
|
||||
],
|
||||
options={
|
||||
"verbose_name": "Party",
|
||||
"verbose_name_plural": "Parties",
|
||||
"db_table": "party",
|
||||
},
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name="Invoice",
|
||||
fields=[
|
||||
(
|
||||
"id",
|
||||
models.BigAutoField(
|
||||
auto_created=True,
|
||||
primary_key=True,
|
||||
serialize=False,
|
||||
verbose_name="ID",
|
||||
),
|
||||
),
|
||||
("name", models.CharField(max_length=256)),
|
||||
(
|
||||
"price",
|
||||
models.DecimalField(decimal_places=2, max_digits=10),
|
||||
),
|
||||
(
|
||||
"party_id",
|
||||
models.ForeignKey(
|
||||
on_delete=django.db.models.deletion.CASCADE,
|
||||
related_name="invoices",
|
||||
to="eggs.party",
|
||||
),
|
||||
),
|
||||
],
|
||||
options={
|
||||
"verbose_name": "Invoice",
|
||||
"verbose_name_plural": "Invoices",
|
||||
"db_table": "invoice",
|
||||
},
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name="group",
|
||||
name="party_id",
|
||||
field=models.ForeignKey(
|
||||
on_delete=django.db.models.deletion.CASCADE, to="eggs.party"
|
||||
),
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name="CourierHistory",
|
||||
fields=[
|
||||
(
|
||||
"id",
|
||||
models.BigAutoField(
|
||||
auto_created=True,
|
||||
primary_key=True,
|
||||
serialize=False,
|
||||
verbose_name="ID",
|
||||
),
|
||||
),
|
||||
("created_at", models.DateTimeField(auto_now_add=True)),
|
||||
("updated_at", models.DateTimeField(auto_now=True)),
|
||||
("get_eggs", models.IntegerField()),
|
||||
("return_eggs", models.IntegerField(blank=True, null=True)),
|
||||
("broken_eggs", models.IntegerField(blank=True, null=True)),
|
||||
("date", models.DateField(auto_now=True, null=True)),
|
||||
(
|
||||
"group_id",
|
||||
models.ForeignKey(
|
||||
on_delete=django.db.models.deletion.CASCADE,
|
||||
to="eggs.group",
|
||||
),
|
||||
),
|
||||
(
|
||||
"courier_id",
|
||||
models.ForeignKey(
|
||||
on_delete=django.db.models.deletion.CASCADE,
|
||||
related_name="courier_histories",
|
||||
to="eggs.party",
|
||||
),
|
||||
),
|
||||
],
|
||||
options={
|
||||
"verbose_name": "CourierHistory",
|
||||
"verbose_name_plural": "CourierHistories",
|
||||
"db_table": "courier_history",
|
||||
},
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name="OrderItems",
|
||||
fields=[
|
||||
(
|
||||
"id",
|
||||
models.BigAutoField(
|
||||
auto_created=True,
|
||||
primary_key=True,
|
||||
serialize=False,
|
||||
verbose_name="ID",
|
||||
),
|
||||
),
|
||||
("created_at", models.DateTimeField(auto_now_add=True)),
|
||||
("updated_at", models.DateTimeField(auto_now=True)),
|
||||
("count", models.IntegerField()),
|
||||
("discount", models.IntegerField()),
|
||||
(
|
||||
"courier_product_id",
|
||||
models.ForeignKey(
|
||||
on_delete=django.db.models.deletion.CASCADE,
|
||||
to="eggs.courierproduct",
|
||||
),
|
||||
),
|
||||
(
|
||||
"product_id",
|
||||
models.ForeignKey(
|
||||
on_delete=django.db.models.deletion.CASCADE,
|
||||
to="eggs.product",
|
||||
),
|
||||
),
|
||||
],
|
||||
options={
|
||||
"verbose_name": "OrderItem",
|
||||
"verbose_name_plural": "OrderItems",
|
||||
"db_table": "order_item",
|
||||
},
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name="group",
|
||||
name="product_id",
|
||||
field=models.ForeignKey(
|
||||
on_delete=django.db.models.deletion.CASCADE,
|
||||
related_name="groups",
|
||||
to="eggs.product",
|
||||
),
|
||||
),
|
||||
]
|
||||
@@ -0,0 +1,18 @@
|
||||
# Generated by Django 5.0.4 on 2024-04-23 10:28
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("eggs", "0001_initial"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RenameField(
|
||||
model_name="market",
|
||||
old_name="location",
|
||||
new_name="location_id",
|
||||
),
|
||||
]
|
||||
@@ -0,0 +1,29 @@
|
||||
# Generated by Django 5.0.4 on 2024-04-23 11:39
|
||||
|
||||
import django.db.models.deletion
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("eggs", "0002_rename_location_market_location_id"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RemoveField(
|
||||
model_name="group",
|
||||
name="party_id",
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name="group",
|
||||
name="party",
|
||||
field=models.ForeignKey(
|
||||
default=1,
|
||||
on_delete=django.db.models.deletion.CASCADE,
|
||||
related_name="groups",
|
||||
to="eggs.party",
|
||||
),
|
||||
preserve_default=False,
|
||||
),
|
||||
]
|
||||
@@ -0,0 +1,18 @@
|
||||
# Generated by Django 5.0.4 on 2024-04-23 11:39
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("eggs", "0003_remove_group_party_id_group_party"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RenameField(
|
||||
model_name="group",
|
||||
old_name="product_id",
|
||||
new_name="product",
|
||||
),
|
||||
]
|
||||
@@ -0,0 +1,33 @@
|
||||
# Generated by Django 5.0.4 on 2024-04-23 11:55
|
||||
|
||||
import django.db.models.deletion
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("eggs", "0004_rename_product_id_group_product"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RenameField(
|
||||
model_name="group",
|
||||
old_name="product",
|
||||
new_name="product_id",
|
||||
),
|
||||
migrations.RemoveField(
|
||||
model_name="group",
|
||||
name="party",
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name="group",
|
||||
name="party_id",
|
||||
field=models.ForeignKey(
|
||||
default=1,
|
||||
on_delete=django.db.models.deletion.CASCADE,
|
||||
to="eggs.party",
|
||||
),
|
||||
preserve_default=False,
|
||||
),
|
||||
]
|
||||
@@ -0,0 +1,48 @@
|
||||
# Generated by Django 5.0.4 on 2024-04-24 07:17
|
||||
|
||||
import django.db.models.deletion
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
(
|
||||
"eggs",
|
||||
"0005_rename_product_group_product_id_remove_group_party_and_more",
|
||||
),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name="party",
|
||||
name="count",
|
||||
field=models.IntegerField(default=1),
|
||||
preserve_default=False,
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name="party",
|
||||
name="sold",
|
||||
field=models.DecimalField(
|
||||
decimal_places=2, default=1, max_digits=10
|
||||
),
|
||||
preserve_default=False,
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name="party",
|
||||
name="sold_price",
|
||||
field=models.DecimalField(
|
||||
decimal_places=2, default=1, max_digits=10
|
||||
),
|
||||
preserve_default=False,
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name="group",
|
||||
name="party_id",
|
||||
field=models.ForeignKey(
|
||||
on_delete=django.db.models.deletion.CASCADE,
|
||||
related_name="groups",
|
||||
to="eggs.party",
|
||||
),
|
||||
),
|
||||
]
|
||||
@@ -0,0 +1,23 @@
|
||||
# Generated by Django 5.0.4 on 2024-04-24 12:46
|
||||
|
||||
import django.db.models.deletion
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("eggs", "0006_party_count_party_sold_party_sold_price_and_more"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name="courierhistory",
|
||||
name="courier_id",
|
||||
field=models.ForeignKey(
|
||||
on_delete=django.db.models.deletion.CASCADE,
|
||||
related_name="courier_histories",
|
||||
to="eggs.courier",
|
||||
),
|
||||
),
|
||||
]
|
||||
25
core/apps/eggs/migrations/0007_orderitems_order_id.py
Normal file
25
core/apps/eggs/migrations/0007_orderitems_order_id.py
Normal file
@@ -0,0 +1,25 @@
|
||||
# Generated by Django 5.0.4 on 2024-04-24 10:51
|
||||
|
||||
import django.db.models.deletion
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("eggs", "0006_party_count_party_sold_party_sold_price_and_more"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name="orderitems",
|
||||
name="order_id",
|
||||
field=models.ForeignKey(
|
||||
default=1,
|
||||
on_delete=django.db.models.deletion.CASCADE,
|
||||
related_name="order_items",
|
||||
to="eggs.order",
|
||||
),
|
||||
preserve_default=False,
|
||||
),
|
||||
]
|
||||
13
core/apps/eggs/migrations/0008_merge_20240424_1752.py
Normal file
13
core/apps/eggs/migrations/0008_merge_20240424_1752.py
Normal file
@@ -0,0 +1,13 @@
|
||||
# Generated by Django 5.0.4 on 2024-04-24 12:52
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("eggs", "0007_alter_courierhistory_courier_id"),
|
||||
("eggs", "0007_orderitems_order_id"),
|
||||
]
|
||||
|
||||
operations = []
|
||||
18
core/apps/eggs/migrations/0009_alter_party_sold.py
Normal file
18
core/apps/eggs/migrations/0009_alter_party_sold.py
Normal file
@@ -0,0 +1,18 @@
|
||||
# Generated by Django 5.0.4 on 2024-05-01 06:22
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("eggs", "0008_merge_20240424_1752"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name="party",
|
||||
name="sold",
|
||||
field=models.IntegerField(),
|
||||
),
|
||||
]
|
||||
@@ -0,0 +1,61 @@
|
||||
# Generated by Django 5.0.4 on 2024-05-02 11:42
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("eggs", "0009_alter_party_sold"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name="orderitems",
|
||||
name="sale_type",
|
||||
field=models.CharField(
|
||||
choices=[("optom", "Optom"), ("dona", "Dona")],
|
||||
default=1,
|
||||
max_length=10,
|
||||
),
|
||||
preserve_default=False,
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name="order",
|
||||
name="price",
|
||||
field=models.DecimalField(
|
||||
decimal_places=2, default=0.0, max_digits=10
|
||||
),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name="order",
|
||||
name="price_paid",
|
||||
field=models.DecimalField(
|
||||
decimal_places=2, default=0.0, max_digits=10
|
||||
),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name="party",
|
||||
name="count",
|
||||
field=models.IntegerField(default=0),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name="party",
|
||||
name="price",
|
||||
field=models.DecimalField(
|
||||
decimal_places=2, default=0, max_digits=10
|
||||
),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name="party",
|
||||
name="sold",
|
||||
field=models.IntegerField(default=0),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name="party",
|
||||
name="sold_price",
|
||||
field=models.DecimalField(
|
||||
decimal_places=2, default=0, max_digits=10
|
||||
),
|
||||
),
|
||||
]
|
||||
25
core/apps/eggs/migrations/0011_alter_order_courier_id.py
Normal file
25
core/apps/eggs/migrations/0011_alter_order_courier_id.py
Normal file
@@ -0,0 +1,25 @@
|
||||
# Generated by Django 5.0.4 on 2024-05-02 12:08
|
||||
|
||||
import django.db.models.deletion
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("eggs", "0010_orderitems_sale_type_alter_order_price_and_more"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name="order",
|
||||
name="courier_id",
|
||||
field=models.ForeignKey(
|
||||
blank=True,
|
||||
null=True,
|
||||
on_delete=django.db.models.deletion.CASCADE,
|
||||
related_name="orders",
|
||||
to="eggs.courier",
|
||||
),
|
||||
),
|
||||
]
|
||||
18
core/apps/eggs/migrations/0012_alter_order_data.py
Normal file
18
core/apps/eggs/migrations/0012_alter_order_data.py
Normal file
@@ -0,0 +1,18 @@
|
||||
# Generated by Django 5.0.4 on 2024-05-03 07:21
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("eggs", "0011_alter_order_courier_id"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name="order",
|
||||
name="data",
|
||||
field=models.DateField(),
|
||||
),
|
||||
]
|
||||
18
core/apps/eggs/migrations/0013_alter_order_data.py
Normal file
18
core/apps/eggs/migrations/0013_alter_order_data.py
Normal file
@@ -0,0 +1,18 @@
|
||||
# Generated by Django 5.0.4 on 2024-05-03 07:22
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("eggs", "0012_alter_order_data"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name="order",
|
||||
name="data",
|
||||
field=models.DateTimeField(auto_now_add=True),
|
||||
),
|
||||
]
|
||||
23
core/apps/eggs/migrations/0014_group_date_group_name.py
Normal file
23
core/apps/eggs/migrations/0014_group_date_group_name.py
Normal file
@@ -0,0 +1,23 @@
|
||||
# Generated by Django 5.0.4 on 2024-05-03 10:32
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("eggs", "0013_alter_order_data"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name="group",
|
||||
name="date",
|
||||
field=models.DateTimeField(auto_now=True),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name="group",
|
||||
name="name",
|
||||
field=models.CharField(blank=True, max_length=255, null=True),
|
||||
),
|
||||
]
|
||||
25
core/apps/eggs/migrations/0015_alter_group_party_id.py
Normal file
25
core/apps/eggs/migrations/0015_alter_group_party_id.py
Normal file
@@ -0,0 +1,25 @@
|
||||
# Generated by Django 5.0.4 on 2024-05-03 12:27
|
||||
|
||||
import django.db.models.deletion
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("eggs", "0014_group_date_group_name"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name="group",
|
||||
name="party_id",
|
||||
field=models.ForeignKey(
|
||||
blank=True,
|
||||
null=True,
|
||||
on_delete=django.db.models.deletion.CASCADE,
|
||||
related_name="groups",
|
||||
to="eggs.party",
|
||||
),
|
||||
),
|
||||
]
|
||||
19
core/apps/eggs/migrations/0016_market_company_name.py
Normal file
19
core/apps/eggs/migrations/0016_market_company_name.py
Normal file
@@ -0,0 +1,19 @@
|
||||
# Generated by Django 5.0.4 on 2024-05-07 12:28
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("eggs", "0015_alter_group_party_id"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name="market",
|
||||
name="company_name",
|
||||
field=models.CharField(default=1, max_length=255),
|
||||
preserve_default=False,
|
||||
),
|
||||
]
|
||||
@@ -0,0 +1,23 @@
|
||||
# Generated by Django 5.0.4 on 2024-05-07 12:56
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("eggs", "0016_market_company_name"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name="location",
|
||||
name="lat",
|
||||
field=models.BigIntegerField(blank=True, null=True),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name="location",
|
||||
name="long",
|
||||
field=models.BigIntegerField(blank=True, null=True),
|
||||
),
|
||||
]
|
||||
25
core/apps/eggs/migrations/0018_alter_order_market_id.py
Normal file
25
core/apps/eggs/migrations/0018_alter_order_market_id.py
Normal file
@@ -0,0 +1,25 @@
|
||||
# Generated by Django 5.0.4 on 2024-05-08 09:24
|
||||
|
||||
import django.db.models.deletion
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("eggs", "0017_alter_location_lat_alter_location_long"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name="order",
|
||||
name="market_id",
|
||||
field=models.ForeignKey(
|
||||
blank=True,
|
||||
null=True,
|
||||
on_delete=django.db.models.deletion.CASCADE,
|
||||
related_name="orders",
|
||||
to="eggs.market",
|
||||
),
|
||||
),
|
||||
]
|
||||
@@ -0,0 +1,24 @@
|
||||
# Generated by Django 5.0.6 on 2024-05-08 12:14
|
||||
|
||||
import django.db.models.deletion
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("eggs", "0018_alter_order_market_id"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name="orderitems",
|
||||
name="courier_product_id",
|
||||
field=models.ForeignKey(
|
||||
blank=True,
|
||||
null=True,
|
||||
on_delete=django.db.models.deletion.CASCADE,
|
||||
to="eggs.courierproduct",
|
||||
),
|
||||
),
|
||||
]
|
||||
@@ -0,0 +1,27 @@
|
||||
# Generated by Django 5.0.6 on 2024-05-08 12:32
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("eggs", "0019_alter_orderitems_courier_product_id"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name="location",
|
||||
name="lat",
|
||||
field=models.DecimalField(
|
||||
blank=True, decimal_places=25, max_digits=35, null=True
|
||||
),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name="location",
|
||||
name="long",
|
||||
field=models.DecimalField(
|
||||
blank=True, decimal_places=25, max_digits=35, null=True
|
||||
),
|
||||
),
|
||||
]
|
||||
@@ -0,0 +1,23 @@
|
||||
# Generated by Django 5.0.6 on 2024-05-08 12:33
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("eggs", "0020_alter_location_lat_alter_location_long"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name="location",
|
||||
name="lat",
|
||||
field=models.BigIntegerField(blank=True, null=True),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name="location",
|
||||
name="long",
|
||||
field=models.BigIntegerField(blank=True, null=True),
|
||||
),
|
||||
]
|
||||
@@ -0,0 +1,23 @@
|
||||
# Generated by Django 5.0.6 on 2024-05-08 12:35
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("eggs", "0021_alter_location_lat_alter_location_long"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name="location",
|
||||
name="lat",
|
||||
field=models.FloatField(blank=True, null=True),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name="location",
|
||||
name="long",
|
||||
field=models.FloatField(blank=True, null=True),
|
||||
),
|
||||
]
|
||||
42
core/apps/eggs/migrations/0023_broken.py
Normal file
42
core/apps/eggs/migrations/0023_broken.py
Normal file
@@ -0,0 +1,42 @@
|
||||
# Generated by Django 5.0.6 on 2024-05-08 13:58
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("eggs", "0022_alter_location_lat_alter_location_long"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name="Broken",
|
||||
fields=[
|
||||
(
|
||||
"id",
|
||||
models.BigAutoField(
|
||||
auto_created=True,
|
||||
primary_key=True,
|
||||
serialize=False,
|
||||
verbose_name="ID",
|
||||
),
|
||||
),
|
||||
("created_at", models.DateTimeField(auto_now_add=True)),
|
||||
("updated_at", models.DateTimeField(auto_now=True)),
|
||||
("comment", models.TextField(verbose_name="Comment")),
|
||||
("quantity", models.IntegerField(verbose_name="Quantity")),
|
||||
(
|
||||
"product",
|
||||
models.ManyToManyField(
|
||||
related_name="brokens", to="eggs.product"
|
||||
),
|
||||
),
|
||||
],
|
||||
options={
|
||||
"verbose_name": "Broken",
|
||||
"verbose_name_plural": "Brokens",
|
||||
"db_table": "broken",
|
||||
},
|
||||
),
|
||||
]
|
||||
25
core/apps/eggs/migrations/0024_broken_group.py
Normal file
25
core/apps/eggs/migrations/0024_broken_group.py
Normal file
@@ -0,0 +1,25 @@
|
||||
# Generated by Django 5.0.6 on 2024-05-08 14:28
|
||||
|
||||
import django.db.models.deletion
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("eggs", "0023_broken"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name="broken",
|
||||
name="group",
|
||||
field=models.ForeignKey(
|
||||
default=1,
|
||||
on_delete=django.db.models.deletion.CASCADE,
|
||||
related_name="brokens",
|
||||
to="eggs.group",
|
||||
),
|
||||
preserve_default=False,
|
||||
),
|
||||
]
|
||||
17
core/apps/eggs/migrations/0025_remove_broken_product.py
Normal file
17
core/apps/eggs/migrations/0025_remove_broken_product.py
Normal file
@@ -0,0 +1,17 @@
|
||||
# Generated by Django 5.0.6 on 2024-05-08 14:50
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("eggs", "0024_broken_group"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RemoveField(
|
||||
model_name="broken",
|
||||
name="product",
|
||||
),
|
||||
]
|
||||
@@ -0,0 +1,27 @@
|
||||
# Generated by Django 5.0.6 on 2024-05-10 11:43
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("eggs", "0025_remove_broken_product"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name="market",
|
||||
name="debt_paid",
|
||||
field=models.DecimalField(
|
||||
decimal_places=2, default=0, max_digits=10
|
||||
),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name="market",
|
||||
name="debt_unpaid",
|
||||
field=models.DecimalField(
|
||||
decimal_places=2, default=0, max_digits=10
|
||||
),
|
||||
),
|
||||
]
|
||||
@@ -0,0 +1,53 @@
|
||||
# Generated by Django 5.0.6 on 2024-05-10 12:27
|
||||
|
||||
import django.db.models.deletion
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("eggs", "0026_market_debt_paid_market_debt_unpaid"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RemoveField(
|
||||
model_name="orderitems",
|
||||
name="product_id",
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name="orderitems",
|
||||
name="group_id",
|
||||
field=models.ForeignKey(
|
||||
default=1,
|
||||
on_delete=django.db.models.deletion.CASCADE,
|
||||
to="eggs.group",
|
||||
),
|
||||
preserve_default=False,
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name="Debt",
|
||||
fields=[
|
||||
(
|
||||
"id",
|
||||
models.BigAutoField(
|
||||
auto_created=True,
|
||||
primary_key=True,
|
||||
serialize=False,
|
||||
verbose_name="ID",
|
||||
),
|
||||
),
|
||||
(
|
||||
"debt_price",
|
||||
models.DecimalField(decimal_places=2, max_digits=10),
|
||||
),
|
||||
(
|
||||
"market",
|
||||
models.ForeignKey(
|
||||
on_delete=django.db.models.deletion.CASCADE,
|
||||
to="eggs.market",
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
]
|
||||
21
core/apps/eggs/migrations/0028_alter_orderitems_discount.py
Normal file
21
core/apps/eggs/migrations/0028_alter_orderitems_discount.py
Normal file
@@ -0,0 +1,21 @@
|
||||
# Generated by Django 5.0.6 on 2024-05-10 13:47
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
(
|
||||
"eggs",
|
||||
"0027_remove_orderitems_product_id_orderitems_group_id_and_more",
|
||||
),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name="orderitems",
|
||||
name="discount",
|
||||
field=models.IntegerField(blank=True, default=0, null=True),
|
||||
),
|
||||
]
|
||||
20
core/apps/eggs/migrations/0029_order_debt.py
Normal file
20
core/apps/eggs/migrations/0029_order_debt.py
Normal file
@@ -0,0 +1,20 @@
|
||||
# Generated by Django 5.0.6 on 2024-05-10 14:37
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("eggs", "0028_alter_orderitems_discount"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name="order",
|
||||
name="debt",
|
||||
field=models.DecimalField(
|
||||
decimal_places=2, default=0.0, max_digits=10
|
||||
),
|
||||
),
|
||||
]
|
||||
@@ -0,0 +1,94 @@
|
||||
# Generated by Django 5.0.6 on 2024-05-11 07:58
|
||||
|
||||
import django.core.validators
|
||||
import django.db.models.deletion
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("contenttypes", "0002_remove_content_type_name"),
|
||||
("eggs", "0029_order_debt"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name="courierproduct",
|
||||
name="count",
|
||||
field=models.PositiveIntegerField(),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name="group",
|
||||
name="broken_eggs",
|
||||
field=models.IntegerField(
|
||||
validators=[django.core.validators.MinValueValidator(0)]
|
||||
),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name="group",
|
||||
name="quantity",
|
||||
field=models.IntegerField(
|
||||
validators=[django.core.validators.MinValueValidator(0)]
|
||||
),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name="market",
|
||||
name="debt_paid",
|
||||
field=models.DecimalField(
|
||||
decimal_places=2,
|
||||
default=0,
|
||||
max_digits=10,
|
||||
validators=[django.core.validators.MinValueValidator(0)],
|
||||
),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name="market",
|
||||
name="debt_unpaid",
|
||||
field=models.DecimalField(
|
||||
decimal_places=2,
|
||||
default=0,
|
||||
max_digits=10,
|
||||
validators=[django.core.validators.MinValueValidator(0)],
|
||||
),
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name="History",
|
||||
fields=[
|
||||
(
|
||||
"id",
|
||||
models.BigAutoField(
|
||||
auto_created=True,
|
||||
primary_key=True,
|
||||
serialize=False,
|
||||
verbose_name="ID",
|
||||
),
|
||||
),
|
||||
("object_id", models.PositiveIntegerField()),
|
||||
("action", models.CharField(max_length=255)),
|
||||
("timestamp", models.DateTimeField(auto_now_add=True)),
|
||||
(
|
||||
"created_by",
|
||||
models.CharField(blank=True, max_length=255, null=True),
|
||||
),
|
||||
(
|
||||
"created_who",
|
||||
models.CharField(blank=True, max_length=255, null=True),
|
||||
),
|
||||
(
|
||||
"reason",
|
||||
models.CharField(blank=True, max_length=255, null=True),
|
||||
),
|
||||
(
|
||||
"content_type",
|
||||
models.ForeignKey(
|
||||
on_delete=django.db.models.deletion.CASCADE,
|
||||
to="contenttypes.contenttype",
|
||||
),
|
||||
),
|
||||
],
|
||||
options={
|
||||
"ordering": ["-timestamp"],
|
||||
},
|
||||
),
|
||||
]
|
||||
30
core/apps/eggs/migrations/0031_broken_user_id.py
Normal file
30
core/apps/eggs/migrations/0031_broken_user_id.py
Normal file
@@ -0,0 +1,30 @@
|
||||
# Generated by Django 5.0.6 on 2024-05-11 09:51
|
||||
|
||||
import django.db.models.deletion
|
||||
from django.conf import settings
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
(
|
||||
"eggs",
|
||||
"0030_alter_courierproduct_count_alter_group_broken_eggs_and_more",
|
||||
),
|
||||
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name="broken",
|
||||
name="user_id",
|
||||
field=models.ForeignKey(
|
||||
default=1,
|
||||
on_delete=django.db.models.deletion.CASCADE,
|
||||
related_name="broken_eggs",
|
||||
to=settings.AUTH_USER_MODEL,
|
||||
),
|
||||
preserve_default=False,
|
||||
),
|
||||
]
|
||||
20
core/apps/eggs/migrations/0032_history_avatar.py
Normal file
20
core/apps/eggs/migrations/0032_history_avatar.py
Normal file
@@ -0,0 +1,20 @@
|
||||
# Generated by Django 5.0.6 on 2024-05-11 10:12
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("eggs", "0031_broken_user_id"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name="history",
|
||||
name="avatar",
|
||||
field=models.ImageField(
|
||||
blank=True, null=True, upload_to="history_avatars/"
|
||||
),
|
||||
),
|
||||
]
|
||||
27
core/apps/eggs/migrations/0033_alter_broken_user_id.py
Normal file
27
core/apps/eggs/migrations/0033_alter_broken_user_id.py
Normal file
@@ -0,0 +1,27 @@
|
||||
# Generated by Django 5.0.6 on 2024-05-11 11:23
|
||||
|
||||
import django.db.models.deletion
|
||||
from django.conf import settings
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("eggs", "0032_history_avatar"),
|
||||
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name="broken",
|
||||
name="user_id",
|
||||
field=models.ForeignKey(
|
||||
blank=True,
|
||||
null=True,
|
||||
on_delete=django.db.models.deletion.CASCADE,
|
||||
related_name="broken_eggs",
|
||||
to=settings.AUTH_USER_MODEL,
|
||||
),
|
||||
),
|
||||
]
|
||||
54
core/apps/eggs/migrations/0034_allhistory.py
Normal file
54
core/apps/eggs/migrations/0034_allhistory.py
Normal file
@@ -0,0 +1,54 @@
|
||||
# Generated by Django 5.0.6 on 2024-05-11 13:01
|
||||
|
||||
import django.db.models.deletion
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("contenttypes", "0002_remove_content_type_name"),
|
||||
("eggs", "0033_alter_broken_user_id"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name="AllHistory",
|
||||
fields=[
|
||||
(
|
||||
"id",
|
||||
models.BigAutoField(
|
||||
auto_created=True,
|
||||
primary_key=True,
|
||||
serialize=False,
|
||||
verbose_name="ID",
|
||||
),
|
||||
),
|
||||
("object_id", models.PositiveIntegerField()),
|
||||
(
|
||||
"action",
|
||||
models.CharField(blank=True, max_length=255, null=True),
|
||||
),
|
||||
("timestamp", models.DateTimeField(auto_now_add=True)),
|
||||
(
|
||||
"created_by",
|
||||
models.CharField(blank=True, max_length=255, null=True),
|
||||
),
|
||||
(
|
||||
"created_who",
|
||||
models.CharField(blank=True, max_length=255, null=True),
|
||||
),
|
||||
("reason", models.TextField(blank=True, null=True)),
|
||||
(
|
||||
"content_type",
|
||||
models.ForeignKey(
|
||||
on_delete=django.db.models.deletion.CASCADE,
|
||||
to="contenttypes.contenttype",
|
||||
),
|
||||
),
|
||||
],
|
||||
options={
|
||||
"ordering": ["-timestamp"],
|
||||
},
|
||||
),
|
||||
]
|
||||
18
core/apps/eggs/migrations/0035_history_comment.py
Normal file
18
core/apps/eggs/migrations/0035_history_comment.py
Normal file
@@ -0,0 +1,18 @@
|
||||
# Generated by Django 5.0.6 on 2024-05-11 14:18
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("eggs", "0034_allhistory"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name="history",
|
||||
name="comment",
|
||||
field=models.CharField(blank=True, max_length=255, null=True),
|
||||
),
|
||||
]
|
||||
@@ -0,0 +1,33 @@
|
||||
# Generated by Django 5.0.6 on 2024-05-15 10:43
|
||||
|
||||
import django.core.validators
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("eggs", "0035_history_comment"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name="courierproduct",
|
||||
name="return_eggs",
|
||||
field=models.IntegerField(
|
||||
blank=True,
|
||||
default=0,
|
||||
null=True,
|
||||
validators=[django.core.validators.MinValueValidator(0)],
|
||||
verbose_name="Return eggs",
|
||||
),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name="courierproduct",
|
||||
name="count",
|
||||
field=models.IntegerField(
|
||||
validators=[django.core.validators.MinValueValidator(0)],
|
||||
verbose_name="Count of eggs",
|
||||
),
|
||||
),
|
||||
]
|
||||
@@ -0,0 +1,25 @@
|
||||
# Generated by Django 5.0.6 on 2024-05-16 06:32
|
||||
|
||||
import django.db.models.deletion
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("eggs", "0036_courierproduct_return_eggs_and_more"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name="courierhistory",
|
||||
name="courier_product_id",
|
||||
field=models.ForeignKey(
|
||||
blank=True,
|
||||
null=True,
|
||||
on_delete=django.db.models.deletion.CASCADE,
|
||||
related_name="courier_histories",
|
||||
to="eggs.courierproduct",
|
||||
),
|
||||
),
|
||||
]
|
||||
@@ -0,0 +1,25 @@
|
||||
# Generated by Django 5.0.6 on 2024-05-16 13:29
|
||||
|
||||
import django.db.models.deletion
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("eggs", "0037_courierhistory_courier_product_id"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name="courierhistory",
|
||||
name="courier_product_id",
|
||||
field=models.ForeignKey(
|
||||
blank=True,
|
||||
null=True,
|
||||
on_delete=django.db.models.deletion.DO_NOTHING,
|
||||
related_name="courier_histories",
|
||||
to="eggs.courierproduct",
|
||||
),
|
||||
),
|
||||
]
|
||||
@@ -0,0 +1,33 @@
|
||||
# Generated by Django 5.0.6 on 2024-05-16 13:37
|
||||
|
||||
import django.db.models.deletion
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("eggs", "0038_alter_courierhistory_courier_product_id"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name="courierhistory",
|
||||
name="courier_product_id",
|
||||
field=models.ForeignKey(
|
||||
null=True,
|
||||
on_delete=django.db.models.deletion.SET_NULL,
|
||||
related_name="courier_histories",
|
||||
to="eggs.courierproduct",
|
||||
),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name="courierhistory",
|
||||
name="group_id",
|
||||
field=models.ForeignKey(
|
||||
null=True,
|
||||
on_delete=django.db.models.deletion.SET_NULL,
|
||||
to="eggs.group",
|
||||
),
|
||||
),
|
||||
]
|
||||
24
core/apps/eggs/migrations/0040_alter_orderitems_discount.py
Normal file
24
core/apps/eggs/migrations/0040_alter_orderitems_discount.py
Normal file
@@ -0,0 +1,24 @@
|
||||
# Generated by Django 5.0.6 on 2024-06-19 10:40
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("eggs", "0039_alter_courierhistory_courier_product_id_and_more"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name="orderitems",
|
||||
name="discount",
|
||||
field=models.DecimalField(
|
||||
blank=True,
|
||||
decimal_places=2,
|
||||
default=0,
|
||||
max_digits=5,
|
||||
null=True,
|
||||
),
|
||||
),
|
||||
]
|
||||
18
core/apps/eggs/migrations/0041_alter_orderitems_discount.py
Normal file
18
core/apps/eggs/migrations/0041_alter_orderitems_discount.py
Normal file
@@ -0,0 +1,18 @@
|
||||
# Generated by Django 5.0.6 on 2024-06-20 06:52
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("eggs", "0040_alter_orderitems_discount"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name="orderitems",
|
||||
name="discount",
|
||||
field=models.IntegerField(blank=True, default=0, null=True),
|
||||
),
|
||||
]
|
||||
23
core/apps/eggs/migrations/0042_alter_order_location_id.py
Normal file
23
core/apps/eggs/migrations/0042_alter_order_location_id.py
Normal file
@@ -0,0 +1,23 @@
|
||||
# Generated by Django 5.0.6 on 2024-06-21 10:53
|
||||
|
||||
import django.db.models.deletion
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("eggs", "0041_alter_orderitems_discount"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name="order",
|
||||
name="location_id",
|
||||
field=models.ForeignKey(
|
||||
null=True,
|
||||
on_delete=django.db.models.deletion.CASCADE,
|
||||
to="eggs.location",
|
||||
),
|
||||
),
|
||||
]
|
||||
23
core/apps/eggs/migrations/0043_alter_orderitems_group_id.py
Normal file
23
core/apps/eggs/migrations/0043_alter_orderitems_group_id.py
Normal file
@@ -0,0 +1,23 @@
|
||||
# Generated by Django 5.0.6 on 2024-06-21 10:58
|
||||
|
||||
import django.db.models.deletion
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("eggs", "0042_alter_order_location_id"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name="orderitems",
|
||||
name="group_id",
|
||||
field=models.ForeignKey(
|
||||
null=True,
|
||||
on_delete=django.db.models.deletion.CASCADE,
|
||||
to="eggs.group",
|
||||
),
|
||||
),
|
||||
]
|
||||
64
core/apps/eggs/migrations/0044_additionalcost.py
Normal file
64
core/apps/eggs/migrations/0044_additionalcost.py
Normal file
@@ -0,0 +1,64 @@
|
||||
# Generated by Django 5.0.6 on 2024-06-26 09:41
|
||||
|
||||
import django.db.models.deletion
|
||||
from django.conf import settings
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("eggs", "0043_alter_orderitems_group_id"),
|
||||
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name="AdditionalCost",
|
||||
fields=[
|
||||
(
|
||||
"id",
|
||||
models.BigAutoField(
|
||||
auto_created=True,
|
||||
primary_key=True,
|
||||
serialize=False,
|
||||
verbose_name="ID",
|
||||
),
|
||||
),
|
||||
(
|
||||
"name",
|
||||
models.CharField(max_length=255, verbose_name="Name"),
|
||||
),
|
||||
(
|
||||
"price",
|
||||
models.DecimalField(
|
||||
decimal_places=2, max_digits=10, verbose_name="Price"
|
||||
),
|
||||
),
|
||||
(
|
||||
"created_at",
|
||||
models.DateTimeField(
|
||||
auto_now_add=True, verbose_name="Created at"
|
||||
),
|
||||
),
|
||||
(
|
||||
"updated_at",
|
||||
models.DateTimeField(
|
||||
auto_now=True, verbose_name="Updated at"
|
||||
),
|
||||
),
|
||||
(
|
||||
"user",
|
||||
models.ForeignKey(
|
||||
on_delete=django.db.models.deletion.CASCADE,
|
||||
to=settings.AUTH_USER_MODEL,
|
||||
verbose_name="User",
|
||||
),
|
||||
),
|
||||
],
|
||||
options={
|
||||
"verbose_name": "Additional cost",
|
||||
"verbose_name_plural": "Additional costs",
|
||||
},
|
||||
),
|
||||
]
|
||||
27
core/apps/eggs/migrations/0045_alter_additionalcost_user.py
Normal file
27
core/apps/eggs/migrations/0045_alter_additionalcost_user.py
Normal file
@@ -0,0 +1,27 @@
|
||||
# Generated by Django 5.0.6 on 2024-06-26 09:57
|
||||
|
||||
import django.db.models.deletion
|
||||
from django.conf import settings
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("eggs", "0044_additionalcost"),
|
||||
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name="additionalcost",
|
||||
name="user",
|
||||
field=models.ForeignKey(
|
||||
blank=True,
|
||||
null=True,
|
||||
on_delete=django.db.models.deletion.CASCADE,
|
||||
to=settings.AUTH_USER_MODEL,
|
||||
verbose_name="User",
|
||||
),
|
||||
),
|
||||
]
|
||||
@@ -0,0 +1,23 @@
|
||||
# Generated by Django 5.0.6 on 2024-06-26 10:50
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("eggs", "0045_alter_additionalcost_user"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RemoveField(
|
||||
model_name="additionalcost",
|
||||
name="name",
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name="additionalcost",
|
||||
name="reason",
|
||||
field=models.TextField(default=1, verbose_name="Name"),
|
||||
preserve_default=False,
|
||||
),
|
||||
]
|
||||
24
core/apps/eggs/migrations/0047_alter_orderitems_discount.py
Normal file
24
core/apps/eggs/migrations/0047_alter_orderitems_discount.py
Normal file
@@ -0,0 +1,24 @@
|
||||
# Generated by Django 5.0.6 on 2024-06-26 12:00
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("eggs", "0046_remove_additionalcost_name_additionalcost_reason"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name="orderitems",
|
||||
name="discount",
|
||||
field=models.DecimalField(
|
||||
blank=True,
|
||||
decimal_places=2,
|
||||
default=0.0,
|
||||
max_digits=10,
|
||||
null=True,
|
||||
),
|
||||
),
|
||||
]
|
||||
18
core/apps/eggs/migrations/0048_order_count.py
Normal file
18
core/apps/eggs/migrations/0048_order_count.py
Normal file
@@ -0,0 +1,18 @@
|
||||
# Generated by Django 5.0.6 on 2024-06-27 06:50
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("eggs", "0047_alter_orderitems_discount"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name="order",
|
||||
name="count",
|
||||
field=models.IntegerField(blank=True, null=True),
|
||||
),
|
||||
]
|
||||
44
core/apps/eggs/migrations/0049_sklad.py
Normal file
44
core/apps/eggs/migrations/0049_sklad.py
Normal file
@@ -0,0 +1,44 @@
|
||||
# Generated by Django 5.0.6 on 2024-06-27 12:49
|
||||
|
||||
import django.db.models.deletion
|
||||
from django.conf import settings
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("eggs", "0048_order_count"),
|
||||
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name="Sklad",
|
||||
fields=[
|
||||
(
|
||||
"id",
|
||||
models.BigAutoField(
|
||||
auto_created=True,
|
||||
primary_key=True,
|
||||
serialize=False,
|
||||
verbose_name="ID",
|
||||
),
|
||||
),
|
||||
("created_at", models.DateTimeField(auto_now_add=True)),
|
||||
("updated_at", models.DateTimeField(auto_now=True)),
|
||||
(
|
||||
"user_id",
|
||||
models.ForeignKey(
|
||||
on_delete=django.db.models.deletion.CASCADE,
|
||||
related_name="sklad",
|
||||
to=settings.AUTH_USER_MODEL,
|
||||
),
|
||||
),
|
||||
],
|
||||
options={
|
||||
"verbose_name_plural": "Sklad",
|
||||
"db_table": "sklad",
|
||||
},
|
||||
),
|
||||
]
|
||||
@@ -0,0 +1,34 @@
|
||||
# Generated by Django 5.0.6 on 2024-06-28 05:16
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("eggs", "0049_sklad"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name="order",
|
||||
name="debt",
|
||||
field=models.DecimalField(
|
||||
blank=True, decimal_places=2, max_digits=10, null=True
|
||||
),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name="order",
|
||||
name="price_paid",
|
||||
field=models.DecimalField(
|
||||
blank=True, decimal_places=2, max_digits=10, null=True
|
||||
),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name="orderitems",
|
||||
name="discount",
|
||||
field=models.DecimalField(
|
||||
blank=True, decimal_places=2, max_digits=10, null=True
|
||||
),
|
||||
),
|
||||
]
|
||||
@@ -0,0 +1,30 @@
|
||||
# Generated by Django 5.0.6 on 2024-06-28 05:36
|
||||
|
||||
import django.core.validators
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("eggs", "0050_alter_order_debt_alter_order_price_paid_and_more"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name="group",
|
||||
name="broken_eggs",
|
||||
field=models.IntegerField(
|
||||
default=0,
|
||||
validators=[django.core.validators.MinValueValidator(0)],
|
||||
),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name="group",
|
||||
name="quantity",
|
||||
field=models.IntegerField(
|
||||
default=0,
|
||||
validators=[django.core.validators.MinValueValidator(0)],
|
||||
),
|
||||
),
|
||||
]
|
||||
28
core/apps/eggs/migrations/0052_alter_order_status.py
Normal file
28
core/apps/eggs/migrations/0052_alter_order_status.py
Normal file
@@ -0,0 +1,28 @@
|
||||
# Generated by Django 5.0.6 on 2024-06-28 09:44
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("eggs", "0051_alter_group_broken_eggs_alter_group_quantity"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name="order",
|
||||
name="status",
|
||||
field=models.CharField(
|
||||
choices=[
|
||||
("pending", "Pending"),
|
||||
("delivery", "Delivery"),
|
||||
("success", "Success"),
|
||||
("done", "Done"),
|
||||
("cancel", "Cancel"),
|
||||
],
|
||||
default="pending",
|
||||
max_length=255,
|
||||
),
|
||||
),
|
||||
]
|
||||
29
core/apps/eggs/migrations/0053_order_status_was.py
Normal file
29
core/apps/eggs/migrations/0053_order_status_was.py
Normal file
@@ -0,0 +1,29 @@
|
||||
# Generated by Django 5.0.6 on 2024-06-28 10:10
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("eggs", "0052_alter_order_status"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name="order",
|
||||
name="status_was",
|
||||
field=models.CharField(
|
||||
blank=True,
|
||||
choices=[
|
||||
("pending", "Pending"),
|
||||
("delivery", "Delivery"),
|
||||
("success", "Success"),
|
||||
("done", "Done"),
|
||||
("cancel", "Cancel"),
|
||||
],
|
||||
max_length=255,
|
||||
null=True,
|
||||
),
|
||||
),
|
||||
]
|
||||
17
core/apps/eggs/migrations/0054_remove_order_status_was.py
Normal file
17
core/apps/eggs/migrations/0054_remove_order_status_was.py
Normal file
@@ -0,0 +1,17 @@
|
||||
# Generated by Django 5.0.6 on 2024-06-28 10:13
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("eggs", "0053_order_status_was"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RemoveField(
|
||||
model_name="order",
|
||||
name="status_was",
|
||||
),
|
||||
]
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user