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:
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",
|
||||
),
|
||||
]
|
||||
27
core/apps/eggs/migrations/0055_history_user_id.py
Normal file
27
core/apps/eggs/migrations/0055_history_user_id.py
Normal file
@@ -0,0 +1,27 @@
|
||||
# Generated by Django 5.0.6 on 2024-06-28 11:47
|
||||
|
||||
import django.db.models.deletion
|
||||
from django.conf import settings
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("eggs", "0054_remove_order_status_was"),
|
||||
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name="history",
|
||||
name="user_id",
|
||||
field=models.ForeignKey(
|
||||
default=1,
|
||||
on_delete=django.db.models.deletion.CASCADE,
|
||||
related_name="history",
|
||||
to=settings.AUTH_USER_MODEL,
|
||||
),
|
||||
preserve_default=False,
|
||||
),
|
||||
]
|
||||
@@ -0,0 +1,40 @@
|
||||
# Generated by Django 5.0.6 on 2024-07-01 07:12
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("eggs", "0055_history_user_id"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name="order",
|
||||
name="count",
|
||||
field=models.IntegerField(blank=True, default=0, null=True),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name="order",
|
||||
name="debt",
|
||||
field=models.DecimalField(
|
||||
blank=True,
|
||||
decimal_places=2,
|
||||
default=0,
|
||||
max_digits=10,
|
||||
null=True,
|
||||
),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name="order",
|
||||
name="price_paid",
|
||||
field=models.DecimalField(
|
||||
blank=True,
|
||||
decimal_places=2,
|
||||
default=0,
|
||||
max_digits=10,
|
||||
null=True,
|
||||
),
|
||||
),
|
||||
]
|
||||
@@ -0,0 +1,59 @@
|
||||
# Generated by Django 5.0.6 on 2024-07-04 05:35
|
||||
|
||||
import django.core.validators
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("eggs", "0056_alter_order_count_alter_order_debt_and_more"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RenameField(
|
||||
model_name="party",
|
||||
old_name="price",
|
||||
new_name="benefit",
|
||||
),
|
||||
migrations.RenameField(
|
||||
model_name="party",
|
||||
old_name="sold_price",
|
||||
new_name="cost",
|
||||
),
|
||||
migrations.RemoveField(
|
||||
model_name="party",
|
||||
name="sold",
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name="party",
|
||||
name="remaining_count",
|
||||
field=models.IntegerField(
|
||||
default=0,
|
||||
verbose_name=django.core.validators.MinValueValidator(0),
|
||||
),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name="party",
|
||||
name="sold_count",
|
||||
field=models.IntegerField(
|
||||
default=0,
|
||||
verbose_name=django.core.validators.MinValueValidator(0),
|
||||
),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name="party",
|
||||
name="total_cost",
|
||||
field=models.DecimalField(
|
||||
decimal_places=2, default=0, max_digits=10
|
||||
),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name="party",
|
||||
name="count",
|
||||
field=models.IntegerField(
|
||||
default=0,
|
||||
verbose_name=django.core.validators.MinValueValidator(0),
|
||||
),
|
||||
),
|
||||
]
|
||||
@@ -0,0 +1,28 @@
|
||||
# Generated by Django 5.0.6 on 2024-07-06 05:31
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("eggs", "0057_rename_price_party_benefit_and_more"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name="party",
|
||||
name="count",
|
||||
field=models.IntegerField(default=0),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name="party",
|
||||
name="remaining_count",
|
||||
field=models.IntegerField(default=0),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name="party",
|
||||
name="sold_count",
|
||||
field=models.IntegerField(default=0),
|
||||
),
|
||||
]
|
||||
23
core/apps/eggs/migrations/0059_party_profit.py
Normal file
23
core/apps/eggs/migrations/0059_party_profit.py
Normal file
@@ -0,0 +1,23 @@
|
||||
# Generated by Django 5.0.6 on 2024-07-06 07:31
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
(
|
||||
"eggs",
|
||||
"0058_alter_party_count_alter_party_remaining_count_and_more",
|
||||
),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name="party",
|
||||
name="profit",
|
||||
field=models.DecimalField(
|
||||
decimal_places=2, default=0, max_digits=10
|
||||
),
|
||||
),
|
||||
]
|
||||
@@ -0,0 +1,72 @@
|
||||
# Generated by Django 5.0.6 on 2024-07-06 07:45
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("eggs", "0059_party_profit"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name="party",
|
||||
name="benefit",
|
||||
field=models.DecimalField(
|
||||
blank=True,
|
||||
decimal_places=2,
|
||||
default=0,
|
||||
max_digits=10,
|
||||
null=True,
|
||||
),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name="party",
|
||||
name="cost",
|
||||
field=models.DecimalField(
|
||||
blank=True,
|
||||
decimal_places=2,
|
||||
default=0,
|
||||
max_digits=10,
|
||||
null=True,
|
||||
),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name="party",
|
||||
name="count",
|
||||
field=models.IntegerField(blank=True, default=0, null=True),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name="party",
|
||||
name="profit",
|
||||
field=models.DecimalField(
|
||||
blank=True,
|
||||
decimal_places=2,
|
||||
default=0,
|
||||
max_digits=10,
|
||||
null=True,
|
||||
),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name="party",
|
||||
name="remaining_count",
|
||||
field=models.IntegerField(blank=True, default=0, null=True),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name="party",
|
||||
name="sold_count",
|
||||
field=models.IntegerField(blank=True, default=0, null=True),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name="party",
|
||||
name="total_cost",
|
||||
field=models.DecimalField(
|
||||
blank=True,
|
||||
decimal_places=2,
|
||||
default=0,
|
||||
max_digits=10,
|
||||
null=True,
|
||||
),
|
||||
),
|
||||
]
|
||||
@@ -0,0 +1,67 @@
|
||||
# Generated by Django 5.0.6 on 2024-07-06 13:15
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("eggs", "0060_alter_party_benefit_alter_party_cost_and_more"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name="debt",
|
||||
name="debt_price",
|
||||
field=models.DecimalField(decimal_places=2, max_digits=20),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name="group",
|
||||
name="entry_price",
|
||||
field=models.DecimalField(decimal_places=2, max_digits=20),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name="group",
|
||||
name="unit_price",
|
||||
field=models.DecimalField(decimal_places=2, max_digits=20),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name="group",
|
||||
name="wholesale_price",
|
||||
field=models.DecimalField(decimal_places=2, max_digits=20),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name="invoice",
|
||||
name="price",
|
||||
field=models.DecimalField(decimal_places=2, max_digits=20),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name="order",
|
||||
name="debt",
|
||||
field=models.DecimalField(
|
||||
blank=True,
|
||||
decimal_places=2,
|
||||
default=0,
|
||||
max_digits=20,
|
||||
null=True,
|
||||
),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name="order",
|
||||
name="price",
|
||||
field=models.DecimalField(
|
||||
decimal_places=2, default=0, max_digits=20
|
||||
),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name="order",
|
||||
name="price_paid",
|
||||
field=models.DecimalField(
|
||||
blank=True,
|
||||
decimal_places=2,
|
||||
default=0,
|
||||
max_digits=20,
|
||||
null=True,
|
||||
),
|
||||
),
|
||||
]
|
||||
@@ -0,0 +1,60 @@
|
||||
# Generated by Django 5.0.6 on 2024-07-06 13:17
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
(
|
||||
"eggs",
|
||||
"0061_alter_debt_debt_price_alter_group_entry_price_and_more",
|
||||
),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name="party",
|
||||
name="benefit",
|
||||
field=models.DecimalField(
|
||||
blank=True,
|
||||
decimal_places=2,
|
||||
default=0,
|
||||
max_digits=20,
|
||||
null=True,
|
||||
),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name="party",
|
||||
name="cost",
|
||||
field=models.DecimalField(
|
||||
blank=True,
|
||||
decimal_places=2,
|
||||
default=0,
|
||||
max_digits=20,
|
||||
null=True,
|
||||
),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name="party",
|
||||
name="profit",
|
||||
field=models.DecimalField(
|
||||
blank=True,
|
||||
decimal_places=2,
|
||||
default=0,
|
||||
max_digits=20,
|
||||
null=True,
|
||||
),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name="party",
|
||||
name="total_cost",
|
||||
field=models.DecimalField(
|
||||
blank=True,
|
||||
decimal_places=2,
|
||||
default=0,
|
||||
max_digits=20,
|
||||
null=True,
|
||||
),
|
||||
),
|
||||
]
|
||||
@@ -0,0 +1,111 @@
|
||||
# Generated by Django 5.0.6 on 2024-07-06 13:19
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("eggs", "0062_alter_party_benefit_alter_party_cost_and_more"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name="debt",
|
||||
name="debt_price",
|
||||
field=models.DecimalField(decimal_places=2, max_digits=30),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name="group",
|
||||
name="entry_price",
|
||||
field=models.DecimalField(decimal_places=2, max_digits=30),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name="group",
|
||||
name="unit_price",
|
||||
field=models.DecimalField(decimal_places=2, max_digits=30),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name="group",
|
||||
name="wholesale_price",
|
||||
field=models.DecimalField(decimal_places=2, max_digits=30),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name="invoice",
|
||||
name="price",
|
||||
field=models.DecimalField(decimal_places=2, max_digits=30),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name="order",
|
||||
name="debt",
|
||||
field=models.DecimalField(
|
||||
blank=True,
|
||||
decimal_places=2,
|
||||
default=0,
|
||||
max_digits=30,
|
||||
null=True,
|
||||
),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name="order",
|
||||
name="price",
|
||||
field=models.DecimalField(
|
||||
decimal_places=2, default=0, max_digits=30
|
||||
),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name="order",
|
||||
name="price_paid",
|
||||
field=models.DecimalField(
|
||||
blank=True,
|
||||
decimal_places=2,
|
||||
default=0,
|
||||
max_digits=30,
|
||||
null=True,
|
||||
),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name="party",
|
||||
name="benefit",
|
||||
field=models.DecimalField(
|
||||
blank=True,
|
||||
decimal_places=2,
|
||||
default=0,
|
||||
max_digits=30,
|
||||
null=True,
|
||||
),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name="party",
|
||||
name="cost",
|
||||
field=models.DecimalField(
|
||||
blank=True,
|
||||
decimal_places=2,
|
||||
default=0,
|
||||
max_digits=30,
|
||||
null=True,
|
||||
),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name="party",
|
||||
name="profit",
|
||||
field=models.DecimalField(
|
||||
blank=True,
|
||||
decimal_places=2,
|
||||
default=0,
|
||||
max_digits=30,
|
||||
null=True,
|
||||
),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name="party",
|
||||
name="total_cost",
|
||||
field=models.DecimalField(
|
||||
blank=True,
|
||||
decimal_places=2,
|
||||
default=0,
|
||||
max_digits=30,
|
||||
null=True,
|
||||
),
|
||||
),
|
||||
]
|
||||
21
core/apps/eggs/migrations/0064_order_stock_updated.py
Normal file
21
core/apps/eggs/migrations/0064_order_stock_updated.py
Normal file
@@ -0,0 +1,21 @@
|
||||
# Generated by Django 5.0.6 on 2024-07-08 11:13
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
(
|
||||
"eggs",
|
||||
"0063_alter_debt_debt_price_alter_group_entry_price_and_more",
|
||||
),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name="order",
|
||||
name="stock_updated",
|
||||
field=models.BooleanField(default=False),
|
||||
),
|
||||
]
|
||||
17
core/apps/eggs/migrations/0065_remove_order_stock_updated.py
Normal file
17
core/apps/eggs/migrations/0065_remove_order_stock_updated.py
Normal file
@@ -0,0 +1,17 @@
|
||||
# Generated by Django 5.0.6 on 2024-07-08 11:17
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("eggs", "0064_order_stock_updated"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RemoveField(
|
||||
model_name="order",
|
||||
name="stock_updated",
|
||||
),
|
||||
]
|
||||
@@ -0,0 +1,27 @@
|
||||
# Generated by Django 5.0.7 on 2024-07-10 11:25
|
||||
|
||||
import django.utils.timezone
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("eggs", "0065_remove_order_stock_updated"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name="debt",
|
||||
name="created_at",
|
||||
field=models.DateTimeField(
|
||||
auto_now_add=True, default=django.utils.timezone.now
|
||||
),
|
||||
preserve_default=False,
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name="debt",
|
||||
name="updated_at",
|
||||
field=models.DateTimeField(auto_now=True),
|
||||
),
|
||||
]
|
||||
@@ -0,0 +1,27 @@
|
||||
# Generated by Django 5.0.7 on 2024-07-20 05:38
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("eggs", "0066_debt_created_at_debt_updated_at"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name="order",
|
||||
name="debt",
|
||||
field=models.DecimalField(
|
||||
decimal_places=2, default=0, max_digits=30
|
||||
),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name="order",
|
||||
name="price_paid",
|
||||
field=models.DecimalField(
|
||||
decimal_places=2, default=0, max_digits=30
|
||||
),
|
||||
),
|
||||
]
|
||||
23
core/apps/eggs/migrations/0068_alter_market_avatar.py
Normal file
23
core/apps/eggs/migrations/0068_alter_market_avatar.py
Normal file
@@ -0,0 +1,23 @@
|
||||
# Generated by Django 5.0.7 on 2024-07-22 13:07
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("eggs", "0067_alter_order_debt_alter_order_price_paid"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name="market",
|
||||
name="avatar",
|
||||
field=models.ImageField(
|
||||
blank=True,
|
||||
default="market_avatar/default.png",
|
||||
null=True,
|
||||
upload_to="market_avatar/",
|
||||
),
|
||||
),
|
||||
]
|
||||
89
core/apps/eggs/migrations/0069_broken_price_monitoring.py
Normal file
89
core/apps/eggs/migrations/0069_broken_price_monitoring.py
Normal file
@@ -0,0 +1,89 @@
|
||||
# Generated by Django 5.0.7 on 2024-07-23 11:35
|
||||
|
||||
import django.db.models.deletion
|
||||
from django.conf import settings
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("contenttypes", "0002_remove_content_type_name"),
|
||||
("eggs", "0068_alter_market_avatar"),
|
||||
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name="broken",
|
||||
name="price",
|
||||
field=models.DecimalField(
|
||||
blank=True,
|
||||
decimal_places=2,
|
||||
default=0,
|
||||
max_digits=30,
|
||||
null=True,
|
||||
),
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name="Monitoring",
|
||||
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),
|
||||
),
|
||||
(
|
||||
"comment",
|
||||
models.CharField(blank=True, max_length=255, null=True),
|
||||
),
|
||||
(
|
||||
"reason",
|
||||
models.CharField(blank=True, max_length=255, null=True),
|
||||
),
|
||||
(
|
||||
"price",
|
||||
models.DecimalField(
|
||||
blank=True,
|
||||
decimal_places=2,
|
||||
default=0,
|
||||
max_digits=30,
|
||||
null=True,
|
||||
),
|
||||
),
|
||||
(
|
||||
"content_type",
|
||||
models.ForeignKey(
|
||||
on_delete=django.db.models.deletion.CASCADE,
|
||||
to="contenttypes.contenttype",
|
||||
),
|
||||
),
|
||||
(
|
||||
"user_id",
|
||||
models.ForeignKey(
|
||||
on_delete=django.db.models.deletion.CASCADE,
|
||||
related_name="monitoring",
|
||||
to=settings.AUTH_USER_MODEL,
|
||||
),
|
||||
),
|
||||
],
|
||||
options={
|
||||
"ordering": ["-timestamp"],
|
||||
},
|
||||
),
|
||||
]
|
||||
@@ -0,0 +1,23 @@
|
||||
# Generated by Django 5.0.7 on 2024-07-25 02:12
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("eggs", "0069_broken_price_monitoring"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name="party",
|
||||
name="broken_eggs",
|
||||
field=models.IntegerField(blank=True, default=0, null=True),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name="party",
|
||||
name="courier_eggs",
|
||||
field=models.IntegerField(blank=True, default=0, null=True),
|
||||
),
|
||||
]
|
||||
60
core/apps/eggs/migrations/0071_notification.py
Normal file
60
core/apps/eggs/migrations/0071_notification.py
Normal file
@@ -0,0 +1,60 @@
|
||||
# Generated by Django 5.1 on 2024-08-29 06:42
|
||||
|
||||
import django.db.models.deletion
|
||||
from django.conf import settings
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("eggs", "0070_party_broken_eggs_party_courier_eggs"),
|
||||
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name="Notification",
|
||||
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)),
|
||||
(
|
||||
"title",
|
||||
models.CharField(max_length=255, verbose_name="Title"),
|
||||
),
|
||||
("body", models.TextField(verbose_name="Body")),
|
||||
(
|
||||
"is_read",
|
||||
models.BooleanField(default=False, verbose_name="Is read"),
|
||||
),
|
||||
(
|
||||
"is_sending",
|
||||
models.BooleanField(
|
||||
default=False, verbose_name="Is sending"
|
||||
),
|
||||
),
|
||||
(
|
||||
"user",
|
||||
models.ForeignKey(
|
||||
on_delete=django.db.models.deletion.CASCADE,
|
||||
related_name="notifications",
|
||||
to=settings.AUTH_USER_MODEL,
|
||||
verbose_name="User",
|
||||
),
|
||||
),
|
||||
],
|
||||
options={
|
||||
"verbose_name": "Notification",
|
||||
"verbose_name_plural": "Notifications",
|
||||
},
|
||||
),
|
||||
]
|
||||
28
core/apps/eggs/migrations/0072_alter_notification_user.py
Normal file
28
core/apps/eggs/migrations/0072_alter_notification_user.py
Normal file
@@ -0,0 +1,28 @@
|
||||
# Generated by Django 5.0.8 on 2024-08-29 08:56
|
||||
|
||||
import django.db.models.deletion
|
||||
from django.conf import settings
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("eggs", "0071_notification"),
|
||||
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name="notification",
|
||||
name="user",
|
||||
field=models.ForeignKey(
|
||||
blank=True,
|
||||
null=True,
|
||||
on_delete=django.db.models.deletion.CASCADE,
|
||||
related_name="notifications",
|
||||
to=settings.AUTH_USER_MODEL,
|
||||
verbose_name="User",
|
||||
),
|
||||
),
|
||||
]
|
||||
29
core/apps/eggs/migrations/0073_dailycost.py
Normal file
29
core/apps/eggs/migrations/0073_dailycost.py
Normal file
@@ -0,0 +1,29 @@
|
||||
# Generated by Django 5.0.8 on 2024-09-11 04:36
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('eggs', '0072_alter_notification_user'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='DailyCost',
|
||||
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)),
|
||||
('first_cost', models.DecimalField(decimal_places=2, max_digits=40)),
|
||||
('second_cost', models.DecimalField(decimal_places=2, max_digits=40)),
|
||||
('third_cost', models.DecimalField(decimal_places=2, max_digits=40)),
|
||||
],
|
||||
options={
|
||||
'verbose_name': 'Daily Cost',
|
||||
'verbose_name_plural': 'Daily Costs',
|
||||
'db_table': 'daily_costs',
|
||||
},
|
||||
),
|
||||
]
|
||||
19
core/apps/eggs/migrations/0074_alter_debt_market.py
Normal file
19
core/apps/eggs/migrations/0074_alter_debt_market.py
Normal file
@@ -0,0 +1,19 @@
|
||||
# Generated by Django 5.0.8 on 2025-11-04 09:49
|
||||
|
||||
import django.db.models.deletion
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('eggs', '0073_dailycost'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='debt',
|
||||
name='market',
|
||||
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='debts', to='eggs.market'),
|
||||
),
|
||||
]
|
||||
18
core/apps/eggs/migrations/0075_debt_debt_type.py
Normal file
18
core/apps/eggs/migrations/0075_debt_debt_type.py
Normal file
@@ -0,0 +1,18 @@
|
||||
# Generated by Django 5.0.8 on 2025-11-21 11:55
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('eggs', '0074_alter_debt_market'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='debt',
|
||||
name='debt_type',
|
||||
field=models.CharField(choices=[('added', 'Added'), ('lost', 'Lost')], default='lost', max_length=255),
|
||||
),
|
||||
]
|
||||
0
core/apps/eggs/migrations/__init__.py
Normal file
0
core/apps/eggs/migrations/__init__.py
Normal file
21
core/apps/eggs/models/__init__.py
Normal file
21
core/apps/eggs/models/__init__.py
Normal file
@@ -0,0 +1,21 @@
|
||||
from .additional_cost import * # noqa
|
||||
from .all_history import * # noqa
|
||||
from .broken import * # noqa
|
||||
from .courier import * # noqa
|
||||
from .courier_history import * # noqa
|
||||
from .courier_product import * # noqa
|
||||
from .debt import * # noqa
|
||||
from .group import * # noqa
|
||||
from .history import * # noqa
|
||||
from .invoice import * # noqa
|
||||
from .location import * # noqa
|
||||
from .market import * # noqa
|
||||
from .monitoring import * # noqa
|
||||
from .order import * # noqa
|
||||
from .order_item import * # noqa
|
||||
from .order_item import * # noqa
|
||||
from .party import * # noqa
|
||||
from .product import * # noqa
|
||||
from .sklad import * # noqa
|
||||
from .notification import * # noqa
|
||||
from .daily_cost import * # noqa
|
||||
25
core/apps/eggs/models/additional_cost.py
Normal file
25
core/apps/eggs/models/additional_cost.py
Normal file
@@ -0,0 +1,25 @@
|
||||
from django.db import models
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
|
||||
from core.http.models import User
|
||||
|
||||
|
||||
class AdditionalCost(models.Model):
|
||||
user = models.ForeignKey(
|
||||
to=User,
|
||||
verbose_name=_("User"),
|
||||
on_delete=models.CASCADE,
|
||||
null=True,
|
||||
blank=True,
|
||||
)
|
||||
reason = models.TextField(_("Name"))
|
||||
price = models.DecimalField(_("Price"), max_digits=10, decimal_places=2)
|
||||
created_at = models.DateTimeField(_("Created at"), auto_now_add=True)
|
||||
updated_at = models.DateTimeField(_("Updated at"), auto_now=True)
|
||||
|
||||
class Meta:
|
||||
verbose_name = _("Additional cost")
|
||||
verbose_name_plural = _("Additional costs")
|
||||
|
||||
def __str__(self):
|
||||
return self.reason
|
||||
17
core/apps/eggs/models/all_history.py
Normal file
17
core/apps/eggs/models/all_history.py
Normal file
@@ -0,0 +1,17 @@
|
||||
from django.contrib.contenttypes.fields import GenericForeignKey
|
||||
from django.contrib.contenttypes.models import ContentType
|
||||
from django.db import models
|
||||
|
||||
|
||||
class AllHistory(models.Model):
|
||||
content_type = models.ForeignKey(ContentType, on_delete=models.CASCADE)
|
||||
object_id = models.PositiveIntegerField()
|
||||
content_object = GenericForeignKey("content_type", "object_id")
|
||||
action = models.CharField(max_length=255, null=True, blank=True)
|
||||
timestamp = models.DateTimeField(auto_now_add=True)
|
||||
created_by = models.CharField(max_length=255, null=True, blank=True)
|
||||
created_who = models.CharField(max_length=255, null=True, blank=True)
|
||||
reason = models.TextField(null=True, blank=True)
|
||||
|
||||
class Meta:
|
||||
ordering = ["-timestamp"]
|
||||
50
core/apps/eggs/models/broken.py
Normal file
50
core/apps/eggs/models/broken.py
Normal file
@@ -0,0 +1,50 @@
|
||||
from django.db import models
|
||||
|
||||
from core.apps.eggs.models import group
|
||||
from core.http.models import AbstractBaseModel
|
||||
from core.http.models.user import User
|
||||
|
||||
|
||||
class Broken(AbstractBaseModel):
|
||||
user_id = models.ForeignKey(
|
||||
to=User,
|
||||
on_delete=models.CASCADE,
|
||||
related_name="broken_eggs",
|
||||
null=True,
|
||||
blank=True,
|
||||
)
|
||||
group = models.ForeignKey(
|
||||
group.Group, on_delete=models.CASCADE, related_name="brokens"
|
||||
)
|
||||
comment = models.TextField(verbose_name="Comment")
|
||||
quantity = models.IntegerField(verbose_name="Quantity")
|
||||
price = models.DecimalField(
|
||||
max_digits=30, decimal_places=2, default=0, null=True, blank=True
|
||||
)
|
||||
|
||||
def save(self, *args, **kwargs):
|
||||
is_new = self.pk is None
|
||||
if is_new:
|
||||
if self.group.quantity < self.quantity:
|
||||
raise ValueError(
|
||||
"Quantity cannot be greater than group quantity"
|
||||
)
|
||||
self.group.quantity -= self.quantity
|
||||
self.group.party_id.remaining_count -= self.quantity
|
||||
self.group.broken_eggs += self.quantity
|
||||
self.group.party_id.profit -= (
|
||||
self.group.entry_price * self.quantity
|
||||
)
|
||||
self.group.party_id.broken_eggs += self.quantity
|
||||
self.price = self.group.entry_price * self.quantity
|
||||
self.group.save()
|
||||
self.group.party_id.save()
|
||||
super().save(*args, **kwargs)
|
||||
|
||||
def __str__(self):
|
||||
return self.comment
|
||||
|
||||
class Meta:
|
||||
verbose_name = "Broken"
|
||||
verbose_name_plural = "Brokens"
|
||||
db_table = "broken"
|
||||
21
core/apps/eggs/models/courier.py
Normal file
21
core/apps/eggs/models/courier.py
Normal file
@@ -0,0 +1,21 @@
|
||||
"""
|
||||
Courier model
|
||||
"""
|
||||
|
||||
from django.db import models
|
||||
from core.http.models import base
|
||||
from core.http.models.user import User
|
||||
|
||||
|
||||
class Courier(base.AbstractBaseModel):
|
||||
user_id = models.ForeignKey(
|
||||
to=User, on_delete=models.CASCADE, related_name="couriers"
|
||||
)
|
||||
|
||||
def __str__(self):
|
||||
return f"Courier - {self.user_id}"
|
||||
|
||||
class Meta:
|
||||
verbose_name = "Courier"
|
||||
verbose_name_plural = "Couriers"
|
||||
db_table = "courier"
|
||||
39
core/apps/eggs/models/courier_history.py
Normal file
39
core/apps/eggs/models/courier_history.py
Normal file
@@ -0,0 +1,39 @@
|
||||
"""
|
||||
Couirier History model
|
||||
"""
|
||||
|
||||
from django.db import models
|
||||
|
||||
from core.apps.eggs.models import courier, courier_product, group
|
||||
from core.http.models import base
|
||||
|
||||
|
||||
class CourierHistory(base.AbstractBaseModel):
|
||||
courier_id = models.ForeignKey(
|
||||
to=courier.Courier,
|
||||
on_delete=models.CASCADE,
|
||||
related_name="courier_histories",
|
||||
)
|
||||
courier_product_id = models.ForeignKey(
|
||||
to=courier_product.CourierProduct,
|
||||
on_delete=models.SET_NULL,
|
||||
related_name="courier_histories",
|
||||
null=True, # Allow NULL values
|
||||
)
|
||||
group_id = models.ForeignKey(
|
||||
to=group.Group,
|
||||
on_delete=models.SET_NULL,
|
||||
null=True, # Allow NULL values
|
||||
)
|
||||
get_eggs = models.IntegerField()
|
||||
return_eggs = models.IntegerField(null=True, blank=True)
|
||||
broken_eggs = models.IntegerField(null=True, blank=True)
|
||||
date = models.DateField(auto_now=True, null=True, blank=True)
|
||||
|
||||
def __str__(self) -> str:
|
||||
return f"{self.courier_id}, {self.group_id}"
|
||||
|
||||
class Meta:
|
||||
verbose_name = "CourierHistory"
|
||||
verbose_name_plural = "CourierHistories"
|
||||
db_table = "courier_history"
|
||||
42
core/apps/eggs/models/courier_product.py
Normal file
42
core/apps/eggs/models/courier_product.py
Normal file
@@ -0,0 +1,42 @@
|
||||
"""
|
||||
Courier Product model
|
||||
"""
|
||||
|
||||
from django.core.validators import MinValueValidator
|
||||
from django.db import models
|
||||
|
||||
from core.apps.eggs.models import courier, group
|
||||
from core.http.models import base
|
||||
|
||||
|
||||
class CourierProduct(base.AbstractBaseModel):
|
||||
group_id = models.ForeignKey(
|
||||
to=group.Group, on_delete=models.CASCADE, related_name="courier_groups"
|
||||
)
|
||||
count = models.IntegerField(
|
||||
validators=[MinValueValidator(0)], verbose_name="Count of eggs"
|
||||
)
|
||||
courier_id = models.ForeignKey(
|
||||
to=courier.Courier,
|
||||
on_delete=models.CASCADE,
|
||||
related_name="courier_products",
|
||||
)
|
||||
return_eggs = models.IntegerField(
|
||||
default=0,
|
||||
verbose_name="Return eggs",
|
||||
validators=[MinValueValidator(0)],
|
||||
null=True,
|
||||
blank=True,
|
||||
)
|
||||
|
||||
def clean(self):
|
||||
if self.count < 0:
|
||||
raise ValueError("Count must be greater than 0")
|
||||
|
||||
def __str__(self):
|
||||
return f"Courier - {self.courier_id}, group_id - {self.group_id}"
|
||||
|
||||
class Meta:
|
||||
verbose_name = "CourierProduct"
|
||||
verbose_name_plural = "CourierProducts"
|
||||
db_table = "courier_product"
|
||||
14
core/apps/eggs/models/daily_cost.py
Normal file
14
core/apps/eggs/models/daily_cost.py
Normal file
@@ -0,0 +1,14 @@
|
||||
from django.db import models
|
||||
|
||||
from core.http.models import AbstractBaseModel
|
||||
|
||||
|
||||
class DailyCost(AbstractBaseModel):
|
||||
first_cost = models.DecimalField(max_digits=40, decimal_places=2)
|
||||
second_cost = models.DecimalField(max_digits=40, decimal_places=2)
|
||||
third_cost = models.DecimalField(max_digits=40, decimal_places=2)
|
||||
|
||||
class Meta:
|
||||
verbose_name = "Daily Cost"
|
||||
verbose_name_plural = "Daily Costs"
|
||||
db_table = "daily_costs"
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user