-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #84 from Proyecto-integrador-ISPC-2024/development
Mergeo rama development con main para entrega de sprint 1
- Loading branch information
Showing
208 changed files
with
4,731 additions
and
361 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
__pycache__/ |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
""" | ||
ASGI config for Tienda_Campeones project. | ||
It exposes the ASGI callable as a module-level variable named ``application``. | ||
For more information on this file, see | ||
https://docs.djangoproject.com/en/4.2/howto/deployment/asgi/ | ||
""" | ||
|
||
import os | ||
|
||
from django.core.asgi import get_asgi_application | ||
|
||
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'Tienda_Campeones.settings') | ||
|
||
application = get_asgi_application() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,135 @@ | ||
""" | ||
Django settings for Tienda_Campeones project. | ||
Generated by 'django-admin startproject' using Django 4.2. | ||
For more information on this file, see | ||
https://docs.djangoproject.com/en/4.2/topics/settings/ | ||
For the full list of settings and their values, see | ||
https://docs.djangoproject.com/en/4.2/ref/settings/ | ||
""" | ||
|
||
from pathlib import Path | ||
|
||
# Build paths inside the project like this: BASE_DIR / 'subdir'. | ||
BASE_DIR = Path(__file__).resolve().parent.parent | ||
|
||
|
||
# Quick-start development settings - unsuitable for production | ||
# See https://docs.djangoproject.com/en/4.2/howto/deployment/checklist/ | ||
|
||
# SECURITY WARNING: keep the secret key used in production secret! | ||
SECRET_KEY = 'django-insecure-=hb^58$j+@ym@-e_noir7=y=zdzs-=s!acra3q12x$y)+)v$hy' | ||
|
||
# SECURITY WARNING: don't run with debug turned on in production! | ||
DEBUG = True | ||
|
||
ALLOWED_HOSTS = [] | ||
|
||
|
||
# Application definition | ||
|
||
INSTALLED_APPS = [ | ||
'django.contrib.admin', | ||
'django.contrib.auth', | ||
'django.contrib.contenttypes', | ||
'django.contrib.sessions', | ||
'django.contrib.messages', | ||
'django.contrib.staticfiles', | ||
'web', | ||
'rest_framework', | ||
'corsheaders', | ||
] | ||
CORS_ORIGIN_ALLOW_ALL = True | ||
MIDDLEWARE = [ | ||
'corsheaders.middleware.CorsMiddleware', | ||
'django.middleware.security.SecurityMiddleware', | ||
'django.contrib.sessions.middleware.SessionMiddleware', | ||
'django.middleware.common.CommonMiddleware', | ||
'django.middleware.csrf.CsrfViewMiddleware', | ||
'django.contrib.auth.middleware.AuthenticationMiddleware', | ||
'django.contrib.messages.middleware.MessageMiddleware', | ||
'django.middleware.clickjacking.XFrameOptionsMiddleware', | ||
] | ||
|
||
ROOT_URLCONF = 'Tienda_Campeones.urls' | ||
|
||
TEMPLATES = [ | ||
{ | ||
'BACKEND': 'django.template.backends.django.DjangoTemplates', | ||
'DIRS': [], | ||
'APP_DIRS': True, | ||
'OPTIONS': { | ||
'context_processors': [ | ||
'django.template.context_processors.debug', | ||
'django.template.context_processors.request', | ||
'django.contrib.auth.context_processors.auth', | ||
'django.contrib.messages.context_processors.messages', | ||
], | ||
}, | ||
}, | ||
] | ||
|
||
WSGI_APPLICATION = 'Tienda_Campeones.wsgi.application' | ||
|
||
|
||
# Database | ||
# https://docs.djangoproject.com/en/4.2/ref/settings/#databases | ||
|
||
DATABASES = { | ||
'default': { | ||
'ENGINE': 'django.db.backends.mysql', | ||
'NAME': 'campeones_del_mundo', | ||
'USER': 'root', | ||
'PASSWORD': 'root', | ||
'HOST': 'localhost', | ||
'PORT': '3306', | ||
'OPTIONS': { | ||
'sql_mode': 'traditional', | ||
} | ||
} | ||
} | ||
|
||
|
||
|
||
# Password validation | ||
# https://docs.djangoproject.com/en/4.2/ref/settings/#auth-password-validators | ||
|
||
AUTH_PASSWORD_VALIDATORS = [ | ||
{ | ||
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', | ||
}, | ||
{ | ||
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', | ||
}, | ||
{ | ||
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', | ||
}, | ||
{ | ||
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', | ||
}, | ||
] | ||
|
||
|
||
# Internationalization | ||
# https://docs.djangoproject.com/en/4.2/topics/i18n/ | ||
|
||
LANGUAGE_CODE = 'en-us' | ||
|
||
TIME_ZONE = 'UTC' | ||
|
||
USE_I18N = True | ||
|
||
USE_TZ = True | ||
|
||
|
||
# Static files (CSS, JavaScript, Images) | ||
# https://docs.djangoproject.com/en/4.2/howto/static-files/ | ||
|
||
STATIC_URL = 'static/' | ||
|
||
# Default primary key field type | ||
# https://docs.djangoproject.com/en/4.2/ref/settings/#default-auto-field | ||
|
||
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
""" | ||
URL configuration for Tienda_Campeones project. | ||
The `urlpatterns` list routes URLs to views. For more information please see: | ||
https://docs.djangoproject.com/en/4.2/topics/http/urls/ | ||
Examples: | ||
Function views | ||
1. Add an import: from my_app import views | ||
2. Add a URL to urlpatterns: path('', views.home, name='home') | ||
Class-based views | ||
1. Add an import: from other_app.views import Home | ||
2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') | ||
Including another URLconf | ||
1. Import the include() function: from django.urls import include, path | ||
2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) | ||
""" | ||
from django.contrib import admin | ||
from django.urls import path | ||
|
||
urlpatterns = [ | ||
path('admin/', admin.site.urls), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
""" | ||
WSGI config for Tienda_Campeones project. | ||
It exposes the WSGI callable as a module-level variable named ``application``. | ||
For more information on this file, see | ||
https://docs.djangoproject.com/en/4.2/howto/deployment/wsgi/ | ||
""" | ||
|
||
import os | ||
|
||
from django.core.wsgi import get_wsgi_application | ||
|
||
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'Tienda_Campeones.settings') | ||
|
||
application = get_wsgi_application() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#!/usr/bin/env python | ||
"""Django's command-line utility for administrative tasks.""" | ||
import os | ||
import sys | ||
|
||
|
||
def main(): | ||
"""Run administrative tasks.""" | ||
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'Tienda_Campeones.settings') | ||
try: | ||
from django.core.management import execute_from_command_line | ||
except ImportError as exc: | ||
raise ImportError( | ||
"Couldn't import Django. Are you sure it's installed and " | ||
"available on your PYTHONPATH environment variable? Did you " | ||
"forget to activate a virtual environment?" | ||
) from exc | ||
execute_from_command_line(sys.argv) | ||
|
||
|
||
if __name__ == '__main__': | ||
main() |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
from django.contrib import admin | ||
from .models import * | ||
|
||
|
||
# Register your models here. | ||
modelos = [Usuarios, Pedidos, FormasDepagoPedidos, Tarjetas, Productos, ProductosTalles, Talles, FormasDePago, DetallesPedido] | ||
|
||
|
||
for modelo in modelos: | ||
if not admin.site.is_registered(modelo): | ||
admin.site.register(modelo) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
from django.apps import AppConfig | ||
|
||
|
||
class WebConfig(AppConfig): | ||
default_auto_field = 'django.db.models.BigAutoField' | ||
name = 'web' |
Empty file.
Binary file added
BIN
+209 Bytes
Backend/Tienda_Campeones/web/migrations/__pycache__/__init__.cpython-311.pyc
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,132 @@ | ||
from django.db import models | ||
|
||
# Create your models here. | ||
class DetallesPedido(models.Model): | ||
id_detalle = models.AutoField(db_column='ID_detalle', primary_key=True) # Field name made lowercase. | ||
id_pedido = models.ForeignKey('Pedidos', models.DO_NOTHING, db_column='ID_pedido') # Field name made lowercase. | ||
id_producto = models.ForeignKey('Productos', models.DO_NOTHING, db_column='ID_producto') # Field name made lowercase. | ||
id_talle = models.ForeignKey('Talles', models.DO_NOTHING, db_column='ID_talle') # Field name made lowercase. | ||
cantidad = models.IntegerField(db_column='Cantidad') # Field name made lowercase. | ||
subtotal = models.FloatField(db_column='Subtotal') # Field name made lowercase. | ||
|
||
class Meta: | ||
managed = False | ||
db_table = 'detalles_pedido' | ||
verbose_name_plural = 'Detalles de pedidos' | ||
|
||
def __str__(self): | ||
return f"DETALLE DEL PEDIDO : ID: {self.id_detalle}, ID DEL PEDIDO: {self.id_pedido_id}, ID DEL PRODUCTO: {self.id_producto_id}, Cantidad comprada: {self.cantidad}, Subtotal: {self.subtotal}" | ||
|
||
|
||
class FormasDePago(models.Model): | ||
id_forma_de_pago = models.AutoField(db_column='ID_Forma_de_pago', primary_key=True) # Field name made lowercase. | ||
descripcion = models.CharField(db_column='Descripcion', max_length=150) # Field name made lowercase. | ||
|
||
class Meta: | ||
managed = False | ||
db_table = 'formas_de_pago' | ||
verbose_name_plural = 'Formas de pago' | ||
|
||
def __str__(self): | ||
return f"ID_FORMA DE PAGO: {self.id_forma_de_pago}, Descripcion: {self.descripcion}" | ||
|
||
|
||
class FormasDepagoPedidos(models.Model): | ||
id_forma_depago_pedidos = models.AutoField(db_column='ID_Forma_depago_Pedidos', primary_key=True) # Field name made lowercase. | ||
id_pedido = models.ForeignKey('Pedidos', models.DO_NOTHING, db_column='ID_pedido') # Field name made lowercase. | ||
id_forma_de_pago = models.ForeignKey(FormasDePago, models.DO_NOTHING, db_column='ID_forma_de_pago') # Field name made lowercase. | ||
id_tarjeta = models.ForeignKey('Tarjetas', models.DO_NOTHING, db_column='ID_tarjeta', blank=True, null=True) # Field name made lowercase. | ||
|
||
class Meta: | ||
managed = False | ||
db_table = 'formas_depago_pedidos' | ||
verbose_name_plural = 'Formas de pago de pedidos' | ||
def __str__(self): | ||
return f"ID: {self.id_forma_depago_pedidos}, ID_PEDIDO: {self.id_pedido_id}, ID_FORMA DE PAGO: {self.id_forma_de_pago}, ID_TARJETA: {self.id_tarjeta}" | ||
|
||
|
||
|
||
class Pedidos(models.Model): | ||
id_pedido = models.AutoField(db_column='ID_pedido', primary_key=True) # Field name made lowercase. | ||
fecha = models.DateField() | ||
id_usuario = models.ForeignKey('Usuarios', models.DO_NOTHING, db_column='ID_usuario') # Field name made lowercase. | ||
total = models.FloatField(db_column='Total') # Field name made lowercase. | ||
estado = models.CharField(db_column='Estado', max_length=9) # Field name made lowercase. | ||
|
||
class Meta: | ||
managed = False | ||
db_table = 'pedidos' | ||
verbose_name_plural = 'Pedidos' | ||
def __str__(self): | ||
return f"PEDIDO ID:{self.id_pedido}, Fecha: {self.fecha}, ID_usuario: {self.id_usuario_id}, Total: {self.total}, Estado:{self.estado})" | ||
|
||
|
||
|
||
class Productos(models.Model): | ||
id_producto = models.AutoField(db_column='ID_Producto', primary_key=True) # Field name made lowercase. | ||
nombre_producto = models.CharField(db_column='Nombre_producto', max_length=45) # Field name made lowercase. | ||
precio = models.FloatField(db_column='Precio') # Field name made lowercase. | ||
|
||
class Meta: | ||
managed = False | ||
db_table = 'productos' | ||
verbose_name_plural = 'Productos' | ||
def __str__(self): | ||
return f"Producto ID: {self.id_producto}, Nombre del producto: {self.nombre_producto}, Precio: {self.precio})" | ||
|
||
|
||
|
||
class ProductosTalles(models.Model): | ||
id_producto_talle = models.AutoField(db_column='ID_producto_talle', primary_key=True) # Field name made lowercase. | ||
id_producto = models.ForeignKey(Productos, models.DO_NOTHING, db_column='ID_producto') # Field name made lowercase. | ||
id_talle = models.ForeignKey('Talles', models.DO_NOTHING, db_column='ID_talle') # Field name made lowercase. | ||
stock = models.IntegerField(db_column='Stock') # Field name made lowercase. | ||
|
||
class Meta: | ||
managed = False | ||
db_table = 'productos_talles' | ||
verbose_name_plural = 'Productos-Talles' | ||
def __str__(self): | ||
return f"ID: {self.id_producto_talle}, ID_PRODUCTO: {self.id_producto_id}, ID_TALLE: {self.id_talle}, STOCK: {self.stock}" | ||
|
||
|
||
class Talles(models.Model): | ||
id_talle = models.AutoField(db_column='ID_talle', primary_key=True) # Field name made lowercase. | ||
talle = models.CharField(db_column='Talle', max_length=45) # Field name made lowercase. | ||
|
||
class Meta: | ||
managed = False | ||
db_table = 'talles' | ||
verbose_name_plural = 'Talles' | ||
def __str__(self): | ||
return (f"ID: {self.id_talle}, TALLE: {self.talle}") | ||
|
||
|
||
class Tarjetas(models.Model): | ||
id_tarjeta = models.AutoField(db_column='ID_Tarjeta', primary_key=True) # Field name made lowercase. | ||
nombre_tarjeta = models.CharField(db_column='Nombre_tarjeta', unique=True, max_length=100) # Field name made lowercase. | ||
|
||
class Meta: | ||
managed = False | ||
db_table = 'tarjetas' | ||
verbose_name_plural = 'Tarjetas' | ||
def __str__(self): | ||
return (f"ID: {self.id_tarjeta}, NOMBRE: {self.nombre_tarjeta}") | ||
|
||
|
||
class Usuarios(models.Model): | ||
id_usuario = models.AutoField(db_column='ID_usuario', primary_key=True) # Field name made lowercase. | ||
nombre = models.CharField(db_column='Nombre', max_length=50) # Field name made lowercase. | ||
apellido = models.CharField(db_column='Apellido', max_length=50) # Field name made lowercase. | ||
email = models.CharField(db_column='Email', unique=True, max_length=50) # Field name made lowercase. | ||
password = models.CharField(db_column='Password', max_length=120) # Field name made lowercase. | ||
domicilio = models.CharField(db_column='Domicilio', max_length=150) # Field name made lowercase. | ||
rol = models.CharField(max_length=7) | ||
|
||
class Meta: | ||
managed = False | ||
db_table = 'usuarios' | ||
verbose_name_plural = 'Usuarios' | ||
|
||
def __str__(self): | ||
return f"Usuario ID: {self.id_usuario}, Nombre: {self.nombre}, Apellido: {self.apellido}, Email: {self.email}, Domicilio: {self.domicilio}, Rol: {self.rol})" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from django.test import TestCase | ||
|
||
# Create your tests here. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from django.shortcuts import render | ||
|
||
# Create your views here. |
Oops, something went wrong.