Spaces:
Sleeping
Sleeping
create controller tecnicas and refactor views
Browse files- tecnicas/admin.py +27 -0
- tecnicas/controllers/tecnica_controller.py +13 -1
- tecnicas/migrations/0004_alter_calificacion_num_repeticion_and_more.py +50 -0
- tecnicas/migrations/0005_alter_esvocabulario_id_vocabulario_and_more.py +25 -0
- tecnicas/models/calificacion.py +1 -1
- tecnicas/models/escala.py +1 -1
- tecnicas/models/orden.py +1 -1
- tecnicas/models/presentador.py +1 -1
- tecnicas/models/tipo_tecnica.py +1 -1
- tecnicas/views/__init__.py +6 -0
- tecnicas/views/autentication.py +4 -0
- tecnicas/views/login_catador.py +4 -0
- tecnicas/views/main_panel.py +11 -0
- tecnicas/views/management_catadores.py +4 -0
- tecnicas/{views.py → views/panel_sessions.py} +0 -26
- tecnicas/views/seleccion_tecnica.py +6 -0
tecnicas/admin.py
CHANGED
|
@@ -1,3 +1,30 @@
|
|
| 1 |
from django.contrib import admin
|
| 2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
# Register your models here.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
from django.contrib import admin
|
| 2 |
|
| 3 |
+
from .models import CategoriaTecnica
|
| 4 |
+
from .models import TipoTecnica
|
| 5 |
+
from .models import TipoEscala
|
| 6 |
+
from .models import EstiloPalabra
|
| 7 |
+
|
| 8 |
+
from .models import Catador
|
| 9 |
+
from .models import Presentador
|
| 10 |
+
|
| 11 |
+
from .models import Tecnica
|
| 12 |
+
from .models import SesionSensorial
|
| 13 |
+
|
| 14 |
+
from .models import EsAtributo
|
| 15 |
+
from .models import Palabra
|
| 16 |
+
|
| 17 |
# Register your models here.
|
| 18 |
+
admin.site.register(CategoriaTecnica)
|
| 19 |
+
admin.site.register(TipoEscala)
|
| 20 |
+
admin.site.register(TipoTecnica)
|
| 21 |
+
admin.site.register(EstiloPalabra)
|
| 22 |
+
|
| 23 |
+
admin.site.register(Catador)
|
| 24 |
+
admin.site.register(Presentador)
|
| 25 |
+
|
| 26 |
+
admin.site.register(Tecnica)
|
| 27 |
+
admin.site.register(SesionSensorial)
|
| 28 |
+
|
| 29 |
+
admin.site.register(EsAtributo)
|
| 30 |
+
admin.site.register(Palabra)
|
tecnicas/controllers/tecnica_controller.py
CHANGED
|
@@ -1,8 +1,20 @@
|
|
|
|
|
| 1 |
|
| 2 |
class TecnicaController():
|
| 3 |
def __init__(self):
|
| 4 |
pass
|
| 5 |
|
| 6 |
def getTypesTechnique(self):
|
| 7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
pass
|
|
|
|
| 1 |
+
from models import TipoTecnica, CategoriaTecnica
|
| 2 |
|
| 3 |
class TecnicaController():
|
| 4 |
def __init__(self):
|
| 5 |
pass
|
| 6 |
|
| 7 |
def getTypesTechnique(self):
|
| 8 |
+
tecnias = {"cat1", "cat2", "cat3"}
|
| 9 |
+
categorias = CategoriaTecnica.objects.all()
|
| 10 |
+
|
| 11 |
+
for categoria in categorias:
|
| 12 |
+
tipos_tecnica = TipoTecnica.objects.get(pk=categoria.id)
|
| 13 |
+
|
| 14 |
+
tecnias = {categoria.nombre_categoria: tipos_tecnica}
|
| 15 |
+
pass
|
| 16 |
+
|
| 17 |
+
return tecnias
|
| 18 |
+
|
| 19 |
+
class TiposTecnicas():
|
| 20 |
pass
|
tecnicas/migrations/0004_alter_calificacion_num_repeticion_and_more.py
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Generated by Django 5.2.1 on 2025-07-15 17:28
|
| 2 |
+
|
| 3 |
+
import django.db.models.deletion
|
| 4 |
+
import shortuuid.main
|
| 5 |
+
from django.db import migrations, models
|
| 6 |
+
|
| 7 |
+
|
| 8 |
+
class Migration(migrations.Migration):
|
| 9 |
+
|
| 10 |
+
dependencies = [
|
| 11 |
+
('tecnicas', '0003_initial'),
|
| 12 |
+
]
|
| 13 |
+
|
| 14 |
+
operations = [
|
| 15 |
+
migrations.AlterField(
|
| 16 |
+
model_name='calificacion',
|
| 17 |
+
name='num_repeticion',
|
| 18 |
+
field=models.IntegerField(),
|
| 19 |
+
),
|
| 20 |
+
migrations.AlterField(
|
| 21 |
+
model_name='escala',
|
| 22 |
+
name='longitud',
|
| 23 |
+
field=models.IntegerField(),
|
| 24 |
+
),
|
| 25 |
+
migrations.AlterField(
|
| 26 |
+
model_name='esvocabulario',
|
| 27 |
+
name='id_vocabulario',
|
| 28 |
+
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='vocabulario_esvocabulario', to='tecnicas.vocabulario', unique=True),
|
| 29 |
+
),
|
| 30 |
+
migrations.AlterField(
|
| 31 |
+
model_name='posicion',
|
| 32 |
+
name='posicion',
|
| 33 |
+
field=models.IntegerField(),
|
| 34 |
+
),
|
| 35 |
+
migrations.AlterField(
|
| 36 |
+
model_name='presentador',
|
| 37 |
+
name='nombre_usuario',
|
| 38 |
+
field=models.CharField(max_length=255, unique=True),
|
| 39 |
+
),
|
| 40 |
+
migrations.AlterField(
|
| 41 |
+
model_name='sesionsensorial',
|
| 42 |
+
name='codigo_sesion',
|
| 43 |
+
field=models.CharField(default=shortuuid.main.ShortUUID.uuid, editable=False, max_length=22, primary_key=True, serialize=False),
|
| 44 |
+
),
|
| 45 |
+
migrations.AlterField(
|
| 46 |
+
model_name='tipotecnica',
|
| 47 |
+
name='nombre_tecnica',
|
| 48 |
+
field=models.CharField(max_length=255, unique=True),
|
| 49 |
+
),
|
| 50 |
+
]
|
tecnicas/migrations/0005_alter_esvocabulario_id_vocabulario_and_more.py
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Generated by Django 5.2.1 on 2025-07-15 17:31
|
| 2 |
+
|
| 3 |
+
import django.db.models.deletion
|
| 4 |
+
import shortuuid.main
|
| 5 |
+
from django.db import migrations, models
|
| 6 |
+
|
| 7 |
+
|
| 8 |
+
class Migration(migrations.Migration):
|
| 9 |
+
|
| 10 |
+
dependencies = [
|
| 11 |
+
('tecnicas', '0004_alter_calificacion_num_repeticion_and_more'),
|
| 12 |
+
]
|
| 13 |
+
|
| 14 |
+
operations = [
|
| 15 |
+
migrations.AlterField(
|
| 16 |
+
model_name='esvocabulario',
|
| 17 |
+
name='id_vocabulario',
|
| 18 |
+
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='vocabulario_esvocabulario', to='tecnicas.vocabulario'),
|
| 19 |
+
),
|
| 20 |
+
migrations.AlterField(
|
| 21 |
+
model_name='sesionsensorial',
|
| 22 |
+
name='codigo_sesion',
|
| 23 |
+
field=models.CharField(default=shortuuid.main.ShortUUID.uuid, editable=False, max_length=22, primary_key=True, serialize=False),
|
| 24 |
+
),
|
| 25 |
+
]
|
tecnicas/models/calificacion.py
CHANGED
|
@@ -5,7 +5,7 @@ from .tecnica_intensidad import TecnicaIntensidad
|
|
| 5 |
from .catador import Catador
|
| 6 |
|
| 7 |
class Calificacion(models.Model):
|
| 8 |
-
num_repeticion = models.IntegerField(
|
| 9 |
id_producto = models.ForeignKey(Producto, on_delete=models.CASCADE, related_name="calificacion_producto")
|
| 10 |
id_intensidad = models.ForeignKey(TecnicaIntensidad, on_delete=models.CASCADE, related_name="calificacion_tec_intensidad")
|
| 11 |
id_catador = models.ForeignKey(Catador, on_delete=models.CASCADE, related_name="calificacion_catador")
|
|
|
|
| 5 |
from .catador import Catador
|
| 6 |
|
| 7 |
class Calificacion(models.Model):
|
| 8 |
+
num_repeticion = models.IntegerField()
|
| 9 |
id_producto = models.ForeignKey(Producto, on_delete=models.CASCADE, related_name="calificacion_producto")
|
| 10 |
id_intensidad = models.ForeignKey(TecnicaIntensidad, on_delete=models.CASCADE, related_name="calificacion_tec_intensidad")
|
| 11 |
id_catador = models.ForeignKey(Catador, on_delete=models.CASCADE, related_name="calificacion_catador")
|
tecnicas/models/escala.py
CHANGED
|
@@ -5,7 +5,7 @@ from .tipo_escala import TipoEscala
|
|
| 5 |
|
| 6 |
class Escala(models.Model):
|
| 7 |
id_tipo_escala = models.ForeignKey(TipoEscala, on_delete=models.CASCADE, related_name="escala_tipo_escala")
|
| 8 |
-
longitud = models.IntegerField(
|
| 9 |
etiquetas = models.ManyToManyField(Etiqueta)
|
| 10 |
|
| 11 |
def __str__(self):
|
|
|
|
| 5 |
|
| 6 |
class Escala(models.Model):
|
| 7 |
id_tipo_escala = models.ForeignKey(TipoEscala, on_delete=models.CASCADE, related_name="escala_tipo_escala")
|
| 8 |
+
longitud = models.IntegerField()
|
| 9 |
etiquetas = models.ManyToManyField(Etiqueta)
|
| 10 |
|
| 11 |
def __str__(self):
|
tecnicas/models/orden.py
CHANGED
|
@@ -11,4 +11,4 @@ class Orden(models.Model):
|
|
| 11 |
class Posicion(models.Model):
|
| 12 |
id_producto = models.ForeignKey(Producto, on_delete=models.CASCADE, related_name="posicion_producto")
|
| 13 |
id_orden = models.ForeignKey(Orden, on_delete=models.CASCADE, related_name="posicion_orden")
|
| 14 |
-
posicion = models.IntegerField(
|
|
|
|
| 11 |
class Posicion(models.Model):
|
| 12 |
id_producto = models.ForeignKey(Producto, on_delete=models.CASCADE, related_name="posicion_producto")
|
| 13 |
id_orden = models.ForeignKey(Orden, on_delete=models.CASCADE, related_name="posicion_orden")
|
| 14 |
+
posicion = models.IntegerField()
|
tecnicas/models/presentador.py
CHANGED
|
@@ -3,7 +3,7 @@ from django.db import models
|
|
| 3 |
class Presentador(models.Model):
|
| 4 |
nombre = models.CharField(max_length=255)
|
| 5 |
apellido = models.CharField(max_length=255)
|
| 6 |
-
nombre_usuario = models.CharField(max_length=255)
|
| 7 |
contrasena = models.CharField(max_length=255)
|
| 8 |
|
| 9 |
def __str__(self):
|
|
|
|
| 3 |
class Presentador(models.Model):
|
| 4 |
nombre = models.CharField(max_length=255)
|
| 5 |
apellido = models.CharField(max_length=255)
|
| 6 |
+
nombre_usuario = models.CharField(max_length=255, unique=True)
|
| 7 |
contrasena = models.CharField(max_length=255)
|
| 8 |
|
| 9 |
def __str__(self):
|
tecnicas/models/tipo_tecnica.py
CHANGED
|
@@ -3,7 +3,7 @@ from django.db import models
|
|
| 3 |
from .categoria_tecnica import CategoriaTecnica
|
| 4 |
|
| 5 |
class TipoTecnica(models.Model):
|
| 6 |
-
nombre_tecnica = models.CharField(max_length=255)
|
| 7 |
id_categoria_tecnica = models.ForeignKey(CategoriaTecnica, on_delete=models.CASCADE, related_name="tipo_tecnica_categoria_tecnica")
|
| 8 |
|
| 9 |
def __str__(self):
|
|
|
|
| 3 |
from .categoria_tecnica import CategoriaTecnica
|
| 4 |
|
| 5 |
class TipoTecnica(models.Model):
|
| 6 |
+
nombre_tecnica = models.CharField(max_length=255, unique=True)
|
| 7 |
id_categoria_tecnica = models.ForeignKey(CategoriaTecnica, on_delete=models.CASCADE, related_name="tipo_tecnica_categoria_tecnica")
|
| 8 |
|
| 9 |
def __str__(self):
|
tecnicas/views/__init__.py
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from .autentication import autentication
|
| 2 |
+
from .login_catador import catadorLogin
|
| 3 |
+
from .main_panel import mainPanel
|
| 4 |
+
from .management_catadores import managementCatadores
|
| 5 |
+
from .panel_sessions import sesionesPanel
|
| 6 |
+
from .seleccion_tecnica import selecionTecnica
|
tecnicas/views/autentication.py
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from django.shortcuts import render
|
| 2 |
+
|
| 3 |
+
def autentication(req):
|
| 4 |
+
return render(req, "tecnicas/auth.html")
|
tecnicas/views/login_catador.py
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from django.shortcuts import render
|
| 2 |
+
|
| 3 |
+
def catadorLogin(req):
|
| 4 |
+
return render(req, "tecnicas/cata-login.html")
|
tecnicas/views/main_panel.py
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from django.shortcuts import render
|
| 2 |
+
|
| 3 |
+
def mainPanel(req):
|
| 4 |
+
pres = Presente("1233MMAS092222", "Juan Mendez Salazar")
|
| 5 |
+
return render(req, "tecnicas/main-panel.html", context={"presentador":pres})
|
| 6 |
+
|
| 7 |
+
# Auxiliar classes
|
| 8 |
+
class Presente():
|
| 9 |
+
def __init__(self, id, nombre):
|
| 10 |
+
self.id = id
|
| 11 |
+
self.nombre = nombre
|
tecnicas/views/management_catadores.py
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from django.shortcuts import render
|
| 2 |
+
|
| 3 |
+
def managementCatadores(req):
|
| 4 |
+
return render(req, "tecnicas/catadores-panel.html")
|
tecnicas/{views.py → views/panel_sessions.py}
RENAMED
|
@@ -1,40 +1,14 @@
|
|
| 1 |
from django.shortcuts import render
|
| 2 |
|
| 3 |
-
# Create your views here.
|
| 4 |
-
def mainPanel(req):
|
| 5 |
-
pres = Presente("1233MMAS092222", "Juan Mendez Salazar")
|
| 6 |
-
return render(req, "tecnicas/main-panel.html", context={"presentador":pres})
|
| 7 |
-
|
| 8 |
-
def autentication(req):
|
| 9 |
-
return render(req, "tecnicas/auth.html")
|
| 10 |
-
|
| 11 |
-
def catadorLogin(req):
|
| 12 |
-
return render(req, "tecnicas/cata-login.html")
|
| 13 |
-
|
| 14 |
-
def managementCatadores(req):
|
| 15 |
-
return render(req, "tecnicas/catadores-panel.html")
|
| 16 |
-
|
| 17 |
def sesionesPanel(req):
|
| 18 |
elementos = []
|
| 19 |
|
| 20 |
for i in range(6):
|
| 21 |
elementos.append(Elemento("Sesion " + str(i+1), "Hoy", "Convencional"))
|
| 22 |
-
pass
|
| 23 |
|
| 24 |
return render(req, "tecnicas/sesiones-panel.html", context={"elementos":elementos})
|
| 25 |
|
| 26 |
-
def selecionTecnica(req):
|
| 27 |
-
tipos = []
|
| 28 |
-
|
| 29 |
-
return render(req, "tecnicas/seleccion-tecnica.html")
|
| 30 |
-
|
| 31 |
# Auxiliar classes
|
| 32 |
-
|
| 33 |
-
class Presente():
|
| 34 |
-
def __init__(self, id, nombre):
|
| 35 |
-
self.id = id
|
| 36 |
-
self.nombre = nombre
|
| 37 |
-
|
| 38 |
class Elemento():
|
| 39 |
def __init__(self, nombre, fecha, tecnica):
|
| 40 |
self.nombre = nombre
|
|
|
|
| 1 |
from django.shortcuts import render
|
| 2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
def sesionesPanel(req):
|
| 4 |
elementos = []
|
| 5 |
|
| 6 |
for i in range(6):
|
| 7 |
elementos.append(Elemento("Sesion " + str(i+1), "Hoy", "Convencional"))
|
|
|
|
| 8 |
|
| 9 |
return render(req, "tecnicas/sesiones-panel.html", context={"elementos":elementos})
|
| 10 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
# Auxiliar classes
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
class Elemento():
|
| 13 |
def __init__(self, nombre, fecha, tecnica):
|
| 14 |
self.nombre = nombre
|
tecnicas/views/seleccion_tecnica.py
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from django.shortcuts import render
|
| 2 |
+
|
| 3 |
+
def selecionTecnica(req):
|
| 4 |
+
tipos = []
|
| 5 |
+
|
| 6 |
+
return render(req, "tecnicas/seleccion-tecnica.html")
|