mirror of
https://github.com/welton89/RRBEC.git
synced 2026-04-05 13:35:42 +00:00
feat: create app orders and makemigrations
This commit is contained in:
0
gestaoRaul/orders/__init__.py
Normal file
0
gestaoRaul/orders/__init__.py
Normal file
BIN
gestaoRaul/orders/__pycache__/__init__.cpython-313.pyc
Normal file
BIN
gestaoRaul/orders/__pycache__/__init__.cpython-313.pyc
Normal file
Binary file not shown.
BIN
gestaoRaul/orders/__pycache__/admin.cpython-313.pyc
Normal file
BIN
gestaoRaul/orders/__pycache__/admin.cpython-313.pyc
Normal file
Binary file not shown.
BIN
gestaoRaul/orders/__pycache__/apps.cpython-313.pyc
Normal file
BIN
gestaoRaul/orders/__pycache__/apps.cpython-313.pyc
Normal file
Binary file not shown.
BIN
gestaoRaul/orders/__pycache__/models.cpython-313.pyc
Normal file
BIN
gestaoRaul/orders/__pycache__/models.cpython-313.pyc
Normal file
Binary file not shown.
6
gestaoRaul/orders/admin.py
Normal file
6
gestaoRaul/orders/admin.py
Normal file
@@ -0,0 +1,6 @@
|
||||
from django.contrib import admin
|
||||
|
||||
from orders.models import Order
|
||||
|
||||
|
||||
admin.site.register(Order)
|
||||
6
gestaoRaul/orders/apps.py
Normal file
6
gestaoRaul/orders/apps.py
Normal file
@@ -0,0 +1,6 @@
|
||||
from django.apps import AppConfig
|
||||
|
||||
|
||||
class OrdersConfig(AppConfig):
|
||||
default_auto_field = 'django.db.models.BigAutoField'
|
||||
name = 'orders'
|
||||
31
gestaoRaul/orders/migrations/0001_initial.py
Normal file
31
gestaoRaul/orders/migrations/0001_initial.py
Normal 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')),
|
||||
],
|
||||
),
|
||||
]
|
||||
0
gestaoRaul/orders/migrations/__init__.py
Normal file
0
gestaoRaul/orders/migrations/__init__.py
Normal file
Binary file not shown.
Binary file not shown.
18
gestaoRaul/orders/models.py
Normal file
18
gestaoRaul/orders/models.py
Normal 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}"
|
||||
3
gestaoRaul/orders/tests.py
Normal file
3
gestaoRaul/orders/tests.py
Normal file
@@ -0,0 +1,3 @@
|
||||
from django.test import TestCase
|
||||
|
||||
# Create your tests here.
|
||||
3
gestaoRaul/orders/views.py
Normal file
3
gestaoRaul/orders/views.py
Normal file
@@ -0,0 +1,3 @@
|
||||
from django.shortcuts import render
|
||||
|
||||
# Create your views here.
|
||||
Reference in New Issue
Block a user