diff --git a/bodegaTerrazaDelChupi/__pycache__/settings.cpython-37.pyc b/bodegaTerrazaDelChupi/__pycache__/settings.cpython-37.pyc new file mode 100644 index 0000000..e117b2d Binary files /dev/null and b/bodegaTerrazaDelChupi/__pycache__/settings.cpython-37.pyc differ diff --git a/bodegaTerrazaDelChupi/__pycache__/urls.cpython-37.pyc b/bodegaTerrazaDelChupi/__pycache__/urls.cpython-37.pyc new file mode 100644 index 0000000..f84442f Binary files /dev/null and b/bodegaTerrazaDelChupi/__pycache__/urls.cpython-37.pyc differ diff --git a/bodegaTerrazaDelChupi/__pycache__/wsgi.cpython-37.pyc b/bodegaTerrazaDelChupi/__pycache__/wsgi.cpython-37.pyc new file mode 100644 index 0000000..3e50a41 Binary files /dev/null and b/bodegaTerrazaDelChupi/__pycache__/wsgi.cpython-37.pyc differ diff --git a/bodegaTerrazaDelChupi/urls.py b/bodegaTerrazaDelChupi/urls.py index a93c515..6d951ab 100644 --- a/bodegaTerrazaDelChupi/urls.py +++ b/bodegaTerrazaDelChupi/urls.py @@ -32,7 +32,7 @@ #2 Add URL maps to redirect the base URL to our application from django.views.generic import RedirectView urlpatterns += [ - path('', RedirectView.as_view(url='/catalogo/', permanent=True)), + path('/', RedirectView.as_view(url='/catalogo/', permanent=True)), ] #3 Use static() to add url mapping to serve static files during development (only) diff --git a/catalogo/__pycache__/admin.cpython-37.pyc b/catalogo/__pycache__/admin.cpython-37.pyc new file mode 100644 index 0000000..1f0c7ac Binary files /dev/null and b/catalogo/__pycache__/admin.cpython-37.pyc differ diff --git a/catalogo/__pycache__/apps.cpython-37.pyc b/catalogo/__pycache__/apps.cpython-37.pyc new file mode 100644 index 0000000..2bf2ab1 Binary files /dev/null and b/catalogo/__pycache__/apps.cpython-37.pyc differ diff --git a/catalogo/__pycache__/models.cpython-37.pyc b/catalogo/__pycache__/models.cpython-37.pyc new file mode 100644 index 0000000..393f822 Binary files /dev/null and b/catalogo/__pycache__/models.cpython-37.pyc differ diff --git a/catalogo/__pycache__/urls.cpython-37.pyc b/catalogo/__pycache__/urls.cpython-37.pyc new file mode 100644 index 0000000..82d9524 Binary files /dev/null and b/catalogo/__pycache__/urls.cpython-37.pyc differ diff --git a/catalogo/__pycache__/views.cpython-37.pyc b/catalogo/__pycache__/views.cpython-37.pyc new file mode 100644 index 0000000..6074d76 Binary files /dev/null and b/catalogo/__pycache__/views.cpython-37.pyc differ diff --git a/catalogo/models.py b/catalogo/models.py index f0351e4..84d00a8 100644 --- a/catalogo/models.py +++ b/catalogo/models.py @@ -1,73 +1,73 @@ -from django.db import models +from django.db import models -#Create your models here +#Create your models here - -class Bebida(models.Model): + +class Bebida(models.Model): """ - + Modelo que representa una bebida. - - """ - + + """ + nombre = models.CharField(max_length=200) - - + + tamanho = models.IntegerField(help_text="Ingresar solo números en mililitros (ml)") - - sabor = models.CharField(max_length=30) - + + sabor = models.CharField(max_length=30) + proveedor = models.CharField (max_length=200) - - + + GASEOSA = 'GASE' - + CERVEZA = 'CERV' - + WHISKY = 'WHIS' - + VODKA = 'VOD' - + TIPO_BEBIDA = ( - - (GASEOSA, 'Gaseosa'), + + (GASEOSA, 'Gaseosa'), (CERVEZA, 'Cerveza'), - + (WHISKY, 'Whisky'), - - (VODKA, 'Vodka'), - ) - + (VODKA, 'Vodka'), + + ) + tipo = models.CharField (max_length = 4, choices = TIPO_BEBIDA, default = GASEOSA) - - + + contenido_alcohol = models.IntegerField(default=0) - + precio = models.IntegerField(default=0) - - + + stock = models.IntegerField(default=0) - - - def __str__(self): + + + def __str__(self): """ - + String que representa al objeto Bebida - - """ - return self.nombre - - - + """ + + return self.nombre + + + class Cliente (models.Model): @@ -76,28 +76,28 @@ class Cliente (models.Model): ruc = models.CharField(max_length=200) telefono = models.CharField(max_length=200) - def __str__(self): + def __str__(self): """ - + String que representa al objeto Cliente - - """ - return self.nombre - - - + """ + + return self.nombre + + + class Pedido(models.Model): """ - + Modelo que representa un pedido. - - """ - + + """ + no_pedido = models.CharField(max_length=10, unique=True, primary_key=True) f_pedido = models.DateTimeField(auto_now_add=True) @@ -106,12 +106,12 @@ class Pedido(models.Model): monto_total = models.IntegerField (default=0) CONTADO = 'CONT' CREDITO = 'CRED' - + TIPO_PAGO = ( - - (CONTADO, 'Contado'), - (CREDITO, 'Crédito'), + (CONTADO, 'Contado'), + + (CREDITO, 'Crédito'), ) condicion_pago = models.CharField (max_length = 4, choices = TIPO_PAGO, default = CONTADO) @@ -121,15 +121,15 @@ class Pedido(models.Model): (EFECTIVO, 'Efectivo'), (TARJETA, 'Tarjeta'), ) - + medio_pago = models.CharField (max_length = 4, choices = MEDIO_PAGO, default = EFECTIVO) def __str__(self): """ - + String que representa al objeto Pedido - - """ + + """ return self.no_pedido diff --git a/catalogo/templates/base_generic.html b/catalogo/templates/base_generic.html index d551da7..6c3042a 100644 --- a/catalogo/templates/base_generic.html +++ b/catalogo/templates/base_generic.html @@ -7,7 +7,7 @@ - + {% load static %} @@ -15,19 +15,22 @@
+Bienvenido a Terraza Del Chupi, un sitio web básico de Django desarrollado como tutorial de ejemplo para MITIC.
+Bienvenido a Terraza, un sitio web básico de Django desarrollado como tutorial de ejemplo para MITIC.
| Nombre | +Cantidad | + {% for bebida in bebidas %} +
|---|---|
| + {{ bebida.nombre }} + | ++ {{ bebida.stock }} + | +