Initial commit from monorepo
This commit is contained in:
0
purchase_requests/__init__.py
Normal file
0
purchase_requests/__init__.py
Normal file
9
purchase_requests/admin.py
Normal file
9
purchase_requests/admin.py
Normal file
@@ -0,0 +1,9 @@
|
||||
from django.contrib import admin
|
||||
from .models import Request
|
||||
|
||||
|
||||
@admin.register(Request)
|
||||
class RequestAdmin(admin.ModelAdmin):
|
||||
list_display = ['uuid', 'product_uuid', 'quantity', 'user_id', 'created_at']
|
||||
list_filter = ['created_at']
|
||||
search_fields = ['uuid', 'user_id']
|
||||
6
purchase_requests/apps.py
Normal file
6
purchase_requests/apps.py
Normal file
@@ -0,0 +1,6 @@
|
||||
from django.apps import AppConfig
|
||||
|
||||
|
||||
class PurchaseRequestsConfig(AppConfig):
|
||||
default_auto_field = 'django.db.models.BigAutoField'
|
||||
name = 'purchase_requests'
|
||||
32
purchase_requests/migrations/0001_initial.py
Normal file
32
purchase_requests/migrations/0001_initial.py
Normal file
@@ -0,0 +1,32 @@
|
||||
# Generated manually for exchange refactoring
|
||||
|
||||
from django.db import migrations, models
|
||||
import uuid
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
initial = True
|
||||
|
||||
dependencies = [
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='Request',
|
||||
fields=[
|
||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('uuid', models.CharField(default=uuid.uuid4, max_length=100, unique=True)),
|
||||
('product_uuid', models.CharField(max_length=100)),
|
||||
('quantity', models.DecimalField(decimal_places=2, max_digits=10)),
|
||||
('source_location_uuid', models.CharField(max_length=100)),
|
||||
('user_id', models.CharField(max_length=255)),
|
||||
('created_at', models.DateTimeField(auto_now_add=True)),
|
||||
('updated_at', models.DateTimeField(auto_now=True)),
|
||||
],
|
||||
options={
|
||||
'db_table': 'calculations',
|
||||
'ordering': ['-created_at'],
|
||||
},
|
||||
),
|
||||
]
|
||||
0
purchase_requests/migrations/__init__.py
Normal file
0
purchase_requests/migrations/__init__.py
Normal file
21
purchase_requests/models.py
Normal file
21
purchase_requests/models.py
Normal file
@@ -0,0 +1,21 @@
|
||||
from django.db import models
|
||||
import uuid
|
||||
|
||||
|
||||
class Request(models.Model):
|
||||
"""Заявка покупателя (RFQ - Request For Quotation)"""
|
||||
uuid = models.CharField(max_length=100, unique=True, default=uuid.uuid4)
|
||||
product_uuid = models.CharField(max_length=100)
|
||||
quantity = models.DecimalField(max_digits=10, decimal_places=2)
|
||||
source_location_uuid = models.CharField(max_length=100)
|
||||
user_id = models.CharField(max_length=255)
|
||||
|
||||
created_at = models.DateTimeField(auto_now_add=True)
|
||||
updated_at = models.DateTimeField(auto_now=True)
|
||||
|
||||
class Meta:
|
||||
db_table = 'calculations' # Keep old table name for data compatibility
|
||||
ordering = ['-created_at']
|
||||
|
||||
def __str__(self):
|
||||
return f"Заявка {self.uuid} - {self.quantity}"
|
||||
Reference in New Issue
Block a user