feat: create app orders and makemigrations

This commit is contained in:
2025-01-10 14:01:14 -03:00
parent faaf0d3576
commit 0e096207a6
49 changed files with 116 additions and 103 deletions

View File

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,6 @@
from django.contrib import admin
from orders.models import Order
admin.site.register(Order)

View File

@@ -0,0 +1,6 @@
from django.apps import AppConfig
class OrdersConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'orders'

View File

@@ -0,0 +1,31 @@
# Generated by Django 5.1.4 on 2025-01-10 16:28
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
('comandas', '0003_comanda_status_alter_productcomanda_product'),
('products', '0003_product_cuisine'),
]
operations = [
migrations.CreateModel(
name='Order',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('obs', models.TextField(blank=True, null=True)),
('queue', models.DateTimeField(auto_now_add=True)),
('preparing', models.DateTimeField(blank=True, null=True)),
('finished', models.DateTimeField(blank=True, null=True)),
('delivered', models.DateTimeField(blank=True, null=True)),
('canceled', models.DateTimeField(blank=True, null=True)),
('id_comanda', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='comandas.comanda')),
('id_product', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='products.product')),
],
),
]

View File

View File

@@ -0,0 +1,18 @@
from django.db import models
from products.models import Product
from comandas.models import Comanda
class Order(models.Model):
id_product = models.ForeignKey(Product, on_delete=models.CASCADE)
id_comanda = models.ForeignKey(Comanda, on_delete=models.CASCADE)
obs = models.TextField(blank=True, null=True)
queue = models.DateTimeField(auto_now_add=True)
preparing = models.DateTimeField(null=True, blank=True)
finished = models.DateTimeField(null=True, blank=True)
delivered = models.DateTimeField(null=True, blank=True)
canceled = models.DateTimeField(null=True, blank=True)
def __str__(self):
return f"Pedido {self.id} - Produto: {self.id_product} - Comanda: {self.id_comanda.name}"

View File

@@ -0,0 +1,3 @@
from django.test import TestCase
# Create your tests here.

View File

@@ -0,0 +1,3 @@
from django.shortcuts import render
# Create your views here.