Spaces:
Sleeping
Sleeping
Redefinicion de forms con estilo palabras, creacion de sesion con napping
Browse files- tecnicas/controllers/__init__.py +1 -0
- tecnicas/controllers/models_controller/tecnica_controller.py +1 -1
- tecnicas/controllers/views_controller/create_session/panel_basic_controller.py +37 -8
- tecnicas/controllers/views_controller/create_session/panel_codes_controller.py +5 -29
- tecnicas/controllers/views_controller/create_session/panels_create/panel_create_cata_controller.py +1 -1
- tecnicas/controllers/views_controller/create_session/panels_create/panel_create_napping_controller.py +95 -0
- tecnicas/controllers/views_controller/create_session/panels_create/panel_create_pf_controller.py +1 -1
- tecnicas/controllers/views_controller/create_session/panels_create/panel_create_rata_controller.py +1 -1
- tecnicas/controllers/views_controller/create_session/panels_create/panel_create_sort_controller.py +1 -1
- tecnicas/forms/__init__.py +1 -0
- tecnicas/forms/create_session/sesiob_basic_cata_form.py +7 -2
- tecnicas/forms/create_session/sesion_basic_form.py +7 -2
- tecnicas/forms/create_session/sesion_basic_napping.py +24 -0
- tecnicas/templates/tecnicas/create_sesion/panel-basic-napping.html +71 -0
- tecnicas/views/sessions_config/configuration_panel_basic.py +5 -0
- tecnicas/views/sessions_config/configuration_panel_codes.py +8 -13
- tecnicas/views/sessions_config/configuration_panel_words.py +1 -3
- tecnicas/views/sessions_config/create_session.py +5 -1
tecnicas/controllers/__init__.py
CHANGED
|
@@ -22,6 +22,7 @@ from .views_controller.create_session.panels_create.panel_create_rata_controller
|
|
| 22 |
from .views_controller.create_session.panels_create.panel_create_cata_controller import PanelCreateCataController
|
| 23 |
from .views_controller.create_session.panels_create.panel_create_pf_controller import PanelCreatePFController
|
| 24 |
from .views_controller.create_session.panels_create.panel_create_sort_controller import PanelCreateSortController
|
|
|
|
| 25 |
|
| 26 |
|
| 27 |
from .views_controller.session_management.details.details_controller import DetallesController
|
|
|
|
| 22 |
from .views_controller.create_session.panels_create.panel_create_cata_controller import PanelCreateCataController
|
| 23 |
from .views_controller.create_session.panels_create.panel_create_pf_controller import PanelCreatePFController
|
| 24 |
from .views_controller.create_session.panels_create.panel_create_sort_controller import PanelCreateSortController
|
| 25 |
+
from .views_controller.create_session.panels_create.panel_create_napping_controller import PanelCreateNappingController
|
| 26 |
|
| 27 |
|
| 28 |
from .views_controller.session_management.details.details_controller import DetallesController
|
tecnicas/controllers/models_controller/tecnica_controller.py
CHANGED
|
@@ -16,7 +16,7 @@ class TecnicaController():
|
|
| 16 |
def setTechniqueFromBasicData(self, basic):
|
| 17 |
self.technique = Tecnica(
|
| 18 |
tipo_tecnica=TipoTecnica.objects.get(nombre_tecnica=basic["name_tecnica"]),
|
| 19 |
-
id_estilo=EstiloPalabra.objects.get(
|
| 20 |
repeticiones_max=basic["numero_repeticiones"] or 1,
|
| 21 |
limite_catadores=basic["numero_catadores"],
|
| 22 |
instrucciones=basic["instrucciones"] or "Espere instrucciones del Presentador",
|
|
|
|
| 16 |
def setTechniqueFromBasicData(self, basic):
|
| 17 |
self.technique = Tecnica(
|
| 18 |
tipo_tecnica=TipoTecnica.objects.get(nombre_tecnica=basic["name_tecnica"]),
|
| 19 |
+
id_estilo=EstiloPalabra.objects.get(nombre_estilo=basic["estilo_palabras"]),
|
| 20 |
repeticiones_max=basic["numero_repeticiones"] or 1,
|
| 21 |
limite_catadores=basic["numero_catadores"],
|
| 22 |
instrucciones=basic["instrucciones"] or "Espere instrucciones del Presentador",
|
tecnicas/controllers/views_controller/create_session/panel_basic_controller.py
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
from tecnicas.forms import SesionBasicForm, SesionBasicCATAForm, SesionBasicPFForm, SesionBasicSortForm
|
| 2 |
from django.http import HttpRequest
|
| 3 |
from django.shortcuts import redirect, render
|
| 4 |
from django.urls import reverse
|
|
@@ -14,6 +14,7 @@ class PanelBasicController():
|
|
| 14 |
url_panel_basic_cata = "tecnicas/create_sesion/panel-basic-cata.html"
|
| 15 |
url_panel_basic_pf = "tecnicas/create_sesion/panel-basic-pf.html"
|
| 16 |
url_panel_basic_sort = "tecnicas/create_sesion/panel-basic-sort.html"
|
|
|
|
| 17 |
|
| 18 |
url_next_panel_tags = "cata_system:panel_configuracion_tags"
|
| 19 |
url_next_panel_codes = "cata_system:panel_configuracion_codes"
|
|
@@ -44,7 +45,7 @@ class PanelBasicController():
|
|
| 44 |
if form.is_valid():
|
| 45 |
values = {}
|
| 46 |
for name, value in form.cleaned_data.items():
|
| 47 |
-
if name == "
|
| 48 |
values[name] = value.id
|
| 49 |
else:
|
| 50 |
values[name] = value
|
|
@@ -85,7 +86,7 @@ class PanelBasicController():
|
|
| 85 |
if form.is_valid():
|
| 86 |
values = {}
|
| 87 |
for name, value in form.cleaned_data.items():
|
| 88 |
-
if name == "
|
| 89 |
values[name] = value.id
|
| 90 |
else:
|
| 91 |
values[name] = value
|
|
@@ -133,10 +134,7 @@ class PanelBasicController():
|
|
| 133 |
if form.is_valid():
|
| 134 |
values = {}
|
| 135 |
for name, value in form.cleaned_data.items():
|
| 136 |
-
|
| 137 |
-
values[name] = value.id
|
| 138 |
-
else:
|
| 139 |
-
values[name] = value
|
| 140 |
|
| 141 |
values["name_tecnica"] = name_tecnica
|
| 142 |
request.session['form_basic'] = values
|
|
@@ -208,4 +206,35 @@ class PanelBasicController():
|
|
| 208 |
response = render(request, PanelBasicController.url_panel_basic_sort, {
|
| 209 |
"form_sesion": form, "error": "Información no valida"})
|
| 210 |
|
| 211 |
-
return response
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from tecnicas.forms import SesionBasicForm, SesionBasicCATAForm, SesionBasicPFForm, SesionBasicSortForm, SesionBasicNappingForm
|
| 2 |
from django.http import HttpRequest
|
| 3 |
from django.shortcuts import redirect, render
|
| 4 |
from django.urls import reverse
|
|
|
|
| 14 |
url_panel_basic_cata = "tecnicas/create_sesion/panel-basic-cata.html"
|
| 15 |
url_panel_basic_pf = "tecnicas/create_sesion/panel-basic-pf.html"
|
| 16 |
url_panel_basic_sort = "tecnicas/create_sesion/panel-basic-sort.html"
|
| 17 |
+
url_panel_basic_napping = "tecnicas/create_sesion/panel-basic-napping.html"
|
| 18 |
|
| 19 |
url_next_panel_tags = "cata_system:panel_configuracion_tags"
|
| 20 |
url_next_panel_codes = "cata_system:panel_configuracion_codes"
|
|
|
|
| 45 |
if form.is_valid():
|
| 46 |
values = {}
|
| 47 |
for name, value in form.cleaned_data.items():
|
| 48 |
+
if name == "tipo_escala":
|
| 49 |
values[name] = value.id
|
| 50 |
else:
|
| 51 |
values[name] = value
|
|
|
|
| 86 |
if form.is_valid():
|
| 87 |
values = {}
|
| 88 |
for name, value in form.cleaned_data.items():
|
| 89 |
+
if name == "tipo_escala":
|
| 90 |
values[name] = value.id
|
| 91 |
else:
|
| 92 |
values[name] = value
|
|
|
|
| 134 |
if form.is_valid():
|
| 135 |
values = {}
|
| 136 |
for name, value in form.cleaned_data.items():
|
| 137 |
+
values[name] = value
|
|
|
|
|
|
|
|
|
|
| 138 |
|
| 139 |
values["name_tecnica"] = name_tecnica
|
| 140 |
request.session['form_basic'] = values
|
|
|
|
| 206 |
response = render(request, PanelBasicController.url_panel_basic_sort, {
|
| 207 |
"form_sesion": form, "error": "Información no valida"})
|
| 208 |
|
| 209 |
+
return response
|
| 210 |
+
|
| 211 |
+
@staticmethod
|
| 212 |
+
def controllGetNapping(request: HttpRequest):
|
| 213 |
+
form_sesion = SesionBasicNappingForm()
|
| 214 |
+
|
| 215 |
+
view_context = {
|
| 216 |
+
"form_sesion": form_sesion,
|
| 217 |
+
"use_technique": "napping"
|
| 218 |
+
}
|
| 219 |
+
|
| 220 |
+
return render(
|
| 221 |
+
request, PanelBasicController.url_panel_basic_napping, view_context)
|
| 222 |
+
|
| 223 |
+
@staticmethod
|
| 224 |
+
def controllPostNapping(request: HttpRequest, name_tecnica: str):
|
| 225 |
+
form = SesionBasicNappingForm(request.POST)
|
| 226 |
+
|
| 227 |
+
if form.is_valid():
|
| 228 |
+
values = {}
|
| 229 |
+
for name, value in form.cleaned_data.items():
|
| 230 |
+
values[name] = value
|
| 231 |
+
|
| 232 |
+
values["name_tecnica"] = name_tecnica
|
| 233 |
+
request.session['form_basic'] = values
|
| 234 |
+
response = redirect(
|
| 235 |
+
reverse(PanelBasicController.url_next_panel_codes))
|
| 236 |
+
else:
|
| 237 |
+
response = render(request, PanelBasicController.url_panel_basic_napping, {
|
| 238 |
+
"form_sesion": form, "error": "Información no valida"})
|
| 239 |
+
|
| 240 |
+
return response
|
tecnicas/controllers/views_controller/create_session/panel_codes_controller.py
CHANGED
|
@@ -66,7 +66,7 @@ class PanelCodesController():
|
|
| 66 |
return render(request, PanelCodesController.url_current_panel, context_codes_form)
|
| 67 |
|
| 68 |
@staticmethod
|
| 69 |
-
def
|
| 70 |
num_products = data["numero_productos"]
|
| 71 |
codes_products = generarCodigos(num_products)
|
| 72 |
form_codes = CodesForm(codes=codes_products)
|
|
@@ -80,7 +80,7 @@ class PanelCodesController():
|
|
| 80 |
return render(request, PanelCodesController.url_current_panel, context_codes_form)
|
| 81 |
|
| 82 |
@staticmethod
|
| 83 |
-
def
|
| 84 |
codes = []
|
| 85 |
context_codes_form = {}
|
| 86 |
|
|
@@ -92,7 +92,7 @@ class PanelCodesController():
|
|
| 92 |
|
| 93 |
context_codes_form = {
|
| 94 |
"form_codes": form_codes,
|
| 95 |
-
"use_technique":
|
| 96 |
}
|
| 97 |
|
| 98 |
if form_codes.is_valid():
|
|
@@ -117,31 +117,7 @@ class PanelCodesController():
|
|
| 117 |
return render(request, PanelCodesController.url_current_panel, context_codes_form)
|
| 118 |
|
| 119 |
@staticmethod
|
| 120 |
-
def
|
| 121 |
-
codes = []
|
| 122 |
-
context_codes_form = {}
|
| 123 |
-
|
| 124 |
-
for name, value in request.POST.items():
|
| 125 |
-
if name.__contains__("producto_"):
|
| 126 |
-
codes.append(value)
|
| 127 |
-
|
| 128 |
-
form_codes = CodesForm(request.POST, codes=codes)
|
| 129 |
-
|
| 130 |
-
context_codes_form = {
|
| 131 |
-
"form_codes": form_codes,
|
| 132 |
-
"use_technique": "perfil flash"
|
| 133 |
-
}
|
| 134 |
-
|
| 135 |
-
if form_codes.is_valid():
|
| 136 |
-
request.session["form_codes"] = codes
|
| 137 |
-
return redirect(reverse(PanelCodesController.url_create_session))
|
| 138 |
-
else:
|
| 139 |
-
context_codes_form["error"] = "error en los datos recibidos"
|
| 140 |
-
|
| 141 |
-
return render(request, PanelCodesController.url_current_panel, context_codes_form)
|
| 142 |
-
|
| 143 |
-
@staticmethod
|
| 144 |
-
def controllPostSort(request: HttpRequest):
|
| 145 |
codes = []
|
| 146 |
context_codes_form = {}
|
| 147 |
|
|
@@ -153,7 +129,7 @@ class PanelCodesController():
|
|
| 153 |
|
| 154 |
context_codes_form = {
|
| 155 |
"form_codes": form_codes,
|
| 156 |
-
"use_technique":
|
| 157 |
}
|
| 158 |
|
| 159 |
if form_codes.is_valid():
|
|
|
|
| 66 |
return render(request, PanelCodesController.url_current_panel, context_codes_form)
|
| 67 |
|
| 68 |
@staticmethod
|
| 69 |
+
def controllGetWithoutOrders(request: HttpRequest, data, name_technique: str):
|
| 70 |
num_products = data["numero_productos"]
|
| 71 |
codes_products = generarCodigos(num_products)
|
| 72 |
form_codes = CodesForm(codes=codes_products)
|
|
|
|
| 80 |
return render(request, PanelCodesController.url_current_panel, context_codes_form)
|
| 81 |
|
| 82 |
@staticmethod
|
| 83 |
+
def controllPostWithWords(request: HttpRequest, name_technique: str):
|
| 84 |
codes = []
|
| 85 |
context_codes_form = {}
|
| 86 |
|
|
|
|
| 92 |
|
| 93 |
context_codes_form = {
|
| 94 |
"form_codes": form_codes,
|
| 95 |
+
"use_technique": name_technique
|
| 96 |
}
|
| 97 |
|
| 98 |
if form_codes.is_valid():
|
|
|
|
| 117 |
return render(request, PanelCodesController.url_current_panel, context_codes_form)
|
| 118 |
|
| 119 |
@staticmethod
|
| 120 |
+
def controllPostWithoutOrdersWords(request: HttpRequest, name_technique: str):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 121 |
codes = []
|
| 122 |
context_codes_form = {}
|
| 123 |
|
|
|
|
| 129 |
|
| 130 |
context_codes_form = {
|
| 131 |
"form_codes": form_codes,
|
| 132 |
+
"use_technique": name_technique
|
| 133 |
}
|
| 134 |
|
| 135 |
if form_codes.is_valid():
|
tecnicas/controllers/views_controller/create_session/panels_create/panel_create_cata_controller.py
CHANGED
|
@@ -30,7 +30,7 @@ class PanelCreateCataController(PanelCreateController):
|
|
| 30 |
tipo_tecnica=TipoTecnica.objects.get(
|
| 31 |
nombre_tecnica=data_basic["name_tecnica"]),
|
| 32 |
id_estilo=EstiloPalabra.objects.get(
|
| 33 |
-
|
| 34 |
repeticiones_max=data_basic["numero_repeticiones"] or 1,
|
| 35 |
limite_catadores=data_basic["numero_catadores"],
|
| 36 |
instrucciones=data_basic["instrucciones"] or "Espere instrucciones del Presentador",
|
|
|
|
| 30 |
tipo_tecnica=TipoTecnica.objects.get(
|
| 31 |
nombre_tecnica=data_basic["name_tecnica"]),
|
| 32 |
id_estilo=EstiloPalabra.objects.get(
|
| 33 |
+
nombre_estilo=data_basic["estilo_palabras"]),
|
| 34 |
repeticiones_max=data_basic["numero_repeticiones"] or 1,
|
| 35 |
limite_catadores=data_basic["numero_catadores"],
|
| 36 |
instrucciones=data_basic["instrucciones"] or "Espere instrucciones del Presentador",
|
tecnicas/controllers/views_controller/create_session/panels_create/panel_create_napping_controller.py
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from .panel_create_controller import PanelCreateController
|
| 2 |
+
from django.http import HttpRequest, JsonResponse
|
| 3 |
+
from tecnicas.models import Tecnica, TipoTecnica, EstiloPalabra, Producto, SesionSensorial
|
| 4 |
+
from django.db import transaction
|
| 5 |
+
from tecnicas.utils import deleteDataSession
|
| 6 |
+
|
| 7 |
+
|
| 8 |
+
class PanelCreateNappingController(PanelCreateController):
|
| 9 |
+
def __init__(self):
|
| 10 |
+
super().__init__()
|
| 11 |
+
|
| 12 |
+
@staticmethod
|
| 13 |
+
def controllPost(request: HttpRequest):
|
| 14 |
+
if request.POST.get('action') == 'create_session':
|
| 15 |
+
if not request.session.get("form_basic") or not request.session.get("form_codes"):
|
| 16 |
+
deleteDataSession(request)
|
| 17 |
+
return general_error("No se ha especificado información necesaria para la creación de la sesión, por favor, vuelve a intentarlo")
|
| 18 |
+
try:
|
| 19 |
+
with transaction.atomic():
|
| 20 |
+
# //////////////////////////// #
|
| 21 |
+
#
|
| 22 |
+
# First step: Create technique #
|
| 23 |
+
#
|
| 24 |
+
# //////////////////////////// #
|
| 25 |
+
data_basic = request.session["form_basic"]
|
| 26 |
+
data_basic["numero_catadores"] = data_basic["numero_catadores"] or 2
|
| 27 |
+
data_basic["numero_repeticiones"] = 0
|
| 28 |
+
|
| 29 |
+
technique = Tecnica.objects.create(
|
| 30 |
+
tipo_tecnica=TipoTecnica.objects.get(
|
| 31 |
+
nombre_tecnica=data_basic["name_tecnica"]),
|
| 32 |
+
id_estilo=EstiloPalabra.objects.get(
|
| 33 |
+
nombre_estilo="napping"),
|
| 34 |
+
repeticiones_max=data_basic["numero_repeticiones"],
|
| 35 |
+
limite_catadores=data_basic["numero_catadores"],
|
| 36 |
+
instrucciones=data_basic["instrucciones"] or "Espere instrucciones del Presentador",
|
| 37 |
+
)
|
| 38 |
+
|
| 39 |
+
if not technique:
|
| 40 |
+
raise ValueError("Error al guardar la técnica")
|
| 41 |
+
|
| 42 |
+
# ////////////////////////////////////////////// #
|
| 43 |
+
#
|
| 44 |
+
# Second step: Create productos with their codes #
|
| 45 |
+
#
|
| 46 |
+
# ////////////////////////////////////////////// #
|
| 47 |
+
codes = request.session["form_codes"]
|
| 48 |
+
|
| 49 |
+
if not codes:
|
| 50 |
+
raise ValueError("No hay códigos de productos")
|
| 51 |
+
|
| 52 |
+
products_without_save = []
|
| 53 |
+
for code in codes:
|
| 54 |
+
product = Producto(
|
| 55 |
+
codigoProducto=code,
|
| 56 |
+
id_tecnica=technique
|
| 57 |
+
)
|
| 58 |
+
products_without_save.append(product)
|
| 59 |
+
|
| 60 |
+
Producto.objects.bulk_create(products_without_save)
|
| 61 |
+
|
| 62 |
+
# /////////////////////////////////////////////////////// #
|
| 63 |
+
#
|
| 64 |
+
# Third step: Create session and relat with the technique #
|
| 65 |
+
#
|
| 66 |
+
# /////////////////////////////////////////////////////// #
|
| 67 |
+
session = SesionSensorial.objects.create(
|
| 68 |
+
nombre_sesion=data_basic["nombre_sesion"] if data_basic["nombre_sesion"] != "" else None,
|
| 69 |
+
tecnica=technique,
|
| 70 |
+
creadoPor=request.user.user_presentador
|
| 71 |
+
)
|
| 72 |
+
|
| 73 |
+
if not session:
|
| 74 |
+
raise ValueError("Error al crear sesion sensorial")
|
| 75 |
+
|
| 76 |
+
context = {
|
| 77 |
+
"message": "sesión creada",
|
| 78 |
+
"data": {
|
| 79 |
+
"codigo_sesion": session.codigo_sesion,
|
| 80 |
+
"nombre_sesion": session.nombre_sesion
|
| 81 |
+
}
|
| 82 |
+
}
|
| 83 |
+
|
| 84 |
+
# ////////////////////////////////// #
|
| 85 |
+
#
|
| 86 |
+
# Final step: Delete date en session #
|
| 87 |
+
#
|
| 88 |
+
# ////////////////////////////////// #
|
| 89 |
+
deleteDataSession(request)
|
| 90 |
+
return JsonResponse(context)
|
| 91 |
+
|
| 92 |
+
except ValueError as e:
|
| 93 |
+
return general_error(f"Error: {e}")
|
| 94 |
+
else:
|
| 95 |
+
return general_error("No se ha establecido acción")
|
tecnicas/controllers/views_controller/create_session/panels_create/panel_create_pf_controller.py
CHANGED
|
@@ -29,7 +29,7 @@ class PanelCreatePFController(PanelCreateController):
|
|
| 29 |
tipo_tecnica=TipoTecnica.objects.get(
|
| 30 |
nombre_tecnica=data_basic["name_tecnica"]),
|
| 31 |
id_estilo=EstiloPalabra.objects.get(
|
| 32 |
-
nombre_estilo="
|
| 33 |
repeticiones_max=data_basic["numero_repeticiones"] +
|
| 34 |
phases_before_reptition,
|
| 35 |
limite_catadores=data_basic["numero_catadores"],
|
|
|
|
| 29 |
tipo_tecnica=TipoTecnica.objects.get(
|
| 30 |
nombre_tecnica=data_basic["name_tecnica"]),
|
| 31 |
id_estilo=EstiloPalabra.objects.get(
|
| 32 |
+
nombre_estilo="perfil flash"),
|
| 33 |
repeticiones_max=data_basic["numero_repeticiones"] +
|
| 34 |
phases_before_reptition,
|
| 35 |
limite_catadores=data_basic["numero_catadores"],
|
tecnicas/controllers/views_controller/create_session/panels_create/panel_create_rata_controller.py
CHANGED
|
@@ -31,7 +31,7 @@ class PanelCreateRataController(PanelCreateController):
|
|
| 31 |
tipo_tecnica=TipoTecnica.objects.get(
|
| 32 |
nombre_tecnica=data_basic["name_tecnica"]),
|
| 33 |
id_estilo=EstiloPalabra.objects.get(
|
| 34 |
-
|
| 35 |
repeticiones_max=data_basic["numero_repeticiones"] or 1,
|
| 36 |
limite_catadores=data_basic["numero_catadores"],
|
| 37 |
instrucciones=data_basic["instrucciones"] or "Espere instrucciones del Presentador",
|
|
|
|
| 31 |
tipo_tecnica=TipoTecnica.objects.get(
|
| 32 |
nombre_tecnica=data_basic["name_tecnica"]),
|
| 33 |
id_estilo=EstiloPalabra.objects.get(
|
| 34 |
+
nombre_estilo=data_basic["estilo_palabras"]),
|
| 35 |
repeticiones_max=data_basic["numero_repeticiones"] or 1,
|
| 36 |
limite_catadores=data_basic["numero_catadores"],
|
| 37 |
instrucciones=data_basic["instrucciones"] or "Espere instrucciones del Presentador",
|
tecnicas/controllers/views_controller/create_session/panels_create/panel_create_sort_controller.py
CHANGED
|
@@ -30,7 +30,7 @@ class PanelCreateSortController(PanelCreateController):
|
|
| 30 |
tipo_tecnica=TipoTecnica.objects.get(
|
| 31 |
nombre_tecnica=data_basic["name_tecnica"]),
|
| 32 |
id_estilo=EstiloPalabra.objects.get(
|
| 33 |
-
nombre_estilo="
|
| 34 |
repeticiones_max=data_basic["numero_repeticiones"],
|
| 35 |
limite_catadores=data_basic["numero_catadores"],
|
| 36 |
instrucciones=data_basic["instrucciones"] or "Espere instrucciones del Presentador",
|
|
|
|
| 30 |
tipo_tecnica=TipoTecnica.objects.get(
|
| 31 |
nombre_tecnica=data_basic["name_tecnica"]),
|
| 32 |
id_estilo=EstiloPalabra.objects.get(
|
| 33 |
+
nombre_estilo="sort"),
|
| 34 |
repeticiones_max=data_basic["numero_repeticiones"],
|
| 35 |
limite_catadores=data_basic["numero_catadores"],
|
| 36 |
instrucciones=data_basic["instrucciones"] or "Espere instrucciones del Presentador",
|
tecnicas/forms/__init__.py
CHANGED
|
@@ -3,6 +3,7 @@ from .create_session.sesiob_basic_cata_form import SesionBasicCATAForm
|
|
| 3 |
from .create_session.sesion_basic_pf_form import SesionBasicPFForm
|
| 4 |
from .create_session.sesion_tags_form import SesionTagsForm
|
| 5 |
from .create_session.sesion_basic_sort_form import SesionBasicSortForm
|
|
|
|
| 6 |
|
| 7 |
from .etiqueta_form import EtiquetaForm
|
| 8 |
from .codes_form import CodesForm
|
|
|
|
| 3 |
from .create_session.sesion_basic_pf_form import SesionBasicPFForm
|
| 4 |
from .create_session.sesion_tags_form import SesionTagsForm
|
| 5 |
from .create_session.sesion_basic_sort_form import SesionBasicSortForm
|
| 6 |
+
from .create_session.sesion_basic_napping import SesionBasicNappingForm
|
| 7 |
|
| 8 |
from .etiqueta_form import EtiquetaForm
|
| 9 |
from .codes_form import CodesForm
|
tecnicas/forms/create_session/sesiob_basic_cata_form.py
CHANGED
|
@@ -22,6 +22,11 @@ class SesionBasicCATAForm(forms.Form):
|
|
| 22 |
def __init__(self, *args, **kwargs):
|
| 23 |
super().__init__(*args, **kwargs)
|
| 24 |
|
| 25 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
"class": "uppercase text-lg tracking-wider font-medium p-2 px-4 active:px-5 transition-all rounded-xl bg-blue-500 text-white",
|
| 27 |
-
}), required=True, initial=
|
|
|
|
| 22 |
def __init__(self, *args, **kwargs):
|
| 23 |
super().__init__(*args, **kwargs)
|
| 24 |
|
| 25 |
+
options = [
|
| 26 |
+
("atributos", "atributos"),
|
| 27 |
+
("vocabulario", "vocabulario")
|
| 28 |
+
]
|
| 29 |
+
|
| 30 |
+
self.fields['estilo_palabras'] = forms.ChoiceField(choices=options, widget=forms.RadioSelect(attrs={
|
| 31 |
"class": "uppercase text-lg tracking-wider font-medium p-2 px-4 active:px-5 transition-all rounded-xl bg-blue-500 text-white",
|
| 32 |
+
}), required=True, initial=options[0])
|
tecnicas/forms/create_session/sesion_basic_form.py
CHANGED
|
@@ -38,9 +38,14 @@ class SesionBasicForm(forms.Form):
|
|
| 38 |
if initial_conf is None:
|
| 39 |
initial_conf = {}
|
| 40 |
|
| 41 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 42 |
"class": "uppercase text-lg tracking-wider font-medium p-2 px-4 active:px-5 transition-all rounded-xl bg-blue-500 text-white",
|
| 43 |
-
}), required=True, initial=
|
| 44 |
|
| 45 |
self.fields['tipo_escala'] = forms.ModelChoiceField(queryset=TipoEscala.objects.all(), widget=forms.RadioSelect(attrs={
|
| 46 |
"class": "uppercase text-lg tracking-wider font-medium p-2 px-4 active:px-5 transition-all rounded-xl bg-blue-500 text-white",
|
|
|
|
| 38 |
if initial_conf is None:
|
| 39 |
initial_conf = {}
|
| 40 |
|
| 41 |
+
options = [
|
| 42 |
+
("atributos", "atributos"),
|
| 43 |
+
("vocabulario", "vocabulario")
|
| 44 |
+
]
|
| 45 |
+
|
| 46 |
+
self.fields['estilo_palabras'] = forms.ChoiceField(choices=options, widget=forms.RadioSelect(attrs={
|
| 47 |
"class": "uppercase text-lg tracking-wider font-medium p-2 px-4 active:px-5 transition-all rounded-xl bg-blue-500 text-white",
|
| 48 |
+
}), required=True, initial=options[0])
|
| 49 |
|
| 50 |
self.fields['tipo_escala'] = forms.ModelChoiceField(queryset=TipoEscala.objects.all(), widget=forms.RadioSelect(attrs={
|
| 51 |
"class": "uppercase text-lg tracking-wider font-medium p-2 px-4 active:px-5 transition-all rounded-xl bg-blue-500 text-white",
|
tecnicas/forms/create_session/sesion_basic_napping.py
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from django import forms
|
| 2 |
+
|
| 3 |
+
|
| 4 |
+
class SesionBasicNappingForm(forms.Form):
|
| 5 |
+
nombre_sesion = forms.CharField(max_length=255, widget=forms.TextInput(attrs={
|
| 6 |
+
"class": "bg-surface-ligt border-b-1 text-center w-full p-1",
|
| 7 |
+
"name": "nombre_sesion",
|
| 8 |
+
"placeholder": "Ej. Mermelada de mango picante"
|
| 9 |
+
}), required=False)
|
| 10 |
+
|
| 11 |
+
numero_productos = forms.IntegerField(widget=forms.NumberInput(attrs={
|
| 12 |
+
"class": "bg-surface-ligt p-1 border-b-1 text-center w-full",
|
| 13 |
+
"placeholder": "Solo números"
|
| 14 |
+
}), required=True)
|
| 15 |
+
|
| 16 |
+
numero_catadores = forms.IntegerField(widget=forms.NumberInput(attrs={
|
| 17 |
+
"class": "bg-surface-ligt p-1 border-b-1 text-center w-full",
|
| 18 |
+
"placeholder": "Solo números"
|
| 19 |
+
}), required=True)
|
| 20 |
+
|
| 21 |
+
instrucciones = forms.CharField(max_length=255, widget=forms.TextInput(attrs={
|
| 22 |
+
"class": "bg-surface-ligt border-b-1 text-center w-full p-1",
|
| 23 |
+
"placeholder": "Este campo es opcional"
|
| 24 |
+
}), required=False)
|
tecnicas/templates/tecnicas/create_sesion/panel-basic-napping.html
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{% extends 'tecnicas/layouts/base.html' %}
|
| 2 |
+
{% load static %}
|
| 3 |
+
|
| 4 |
+
{% block title %}Panel Configuracion{% endblock %}
|
| 5 |
+
|
| 6 |
+
{% block content %}
|
| 7 |
+
<article class="cts-container-main">
|
| 8 |
+
<article class="cts-wrap-content text-black">
|
| 9 |
+
<h1 class="text-center font-bold text-4xl">Panel de configuración</h1>
|
| 10 |
+
|
| 11 |
+
{% if error %}
|
| 12 |
+
{% include "../components/error-message.html" with message=error %}
|
| 13 |
+
{% endif %}
|
| 14 |
+
{% if message %}
|
| 15 |
+
{% include "../components/error-message.html" with message=message %}
|
| 16 |
+
{% endif %}
|
| 17 |
+
|
| 18 |
+
<form method="post" action="" class="space-y-4">
|
| 19 |
+
{% csrf_token %}
|
| 20 |
+
<article>
|
| 21 |
+
<h2 class="text-2xl mb-2 font-bold">Información Basica</h2>
|
| 22 |
+
<section class="flex justify-center items-center">
|
| 23 |
+
<label for="{{form_sesion.nombre_sesion.id_for_label}}"
|
| 24 |
+
class="text-lg flex flex-col items-center px-2 w-full font-medium tracking-wide mb-4">
|
| 25 |
+
<p class="tracking-normal text-xl font-bold">Nombre del proyecto:</p>
|
| 26 |
+
{{ form_sesion.nombre_sesion }}
|
| 27 |
+
</label>
|
| 28 |
+
</section>
|
| 29 |
+
<section class="flex flex-row flex-wrap justify-center gap-4">
|
| 30 |
+
<label for="{{ form_sesion.numero_productos.id_for_label }}"
|
| 31 |
+
class="text-lg flex flex-col items-center px-2 font-medium tracking-wide">
|
| 32 |
+
<p class="tracking-normal text-base font-bold">
|
| 33 |
+
Número de Productos:
|
| 34 |
+
</p>
|
| 35 |
+
{{ form_sesion.numero_productos }}
|
| 36 |
+
</label>
|
| 37 |
+
<label for="{{ form_sesion.numero_catadores.id_for_label }}"
|
| 38 |
+
class="text-lg flex flex-col items-center px-2 font-medium tracking-wide">
|
| 39 |
+
<p class="tracking-normal text-base font-bold">
|
| 40 |
+
Número de Catadores:
|
| 41 |
+
</p>
|
| 42 |
+
{{ form_sesion.numero_catadores }}
|
| 43 |
+
</label>
|
| 44 |
+
</section>
|
| 45 |
+
<section class="flex justify-center items-center mt-2">
|
| 46 |
+
<label for="{{form_sesion.instrucciones.id_for_label}}"
|
| 47 |
+
class="text-lg flex flex-col items-center px-2 w-full font-medium tracking-wide mb-4">
|
| 48 |
+
<p class="tracking-normal text-base font-bold">Instrucciones para la sesión:</p>
|
| 49 |
+
{{ form_sesion.instrucciones }}
|
| 50 |
+
</label>
|
| 51 |
+
</section>
|
| 52 |
+
</article>
|
| 53 |
+
|
| 54 |
+
<article class="w-full flex max-sm:flex-col flex-wrap items-center justify-center gap-4">
|
| 55 |
+
<button type="submit" class="cts-btn-general cts-btn-primary btn-push flex-1/4 w-full">
|
| 56 |
+
Continuar
|
| 57 |
+
</button>
|
| 58 |
+
<a href="{% url 'cata_system:seleccion_tecnica' %}" class="flex-1/4 w-full">
|
| 59 |
+
<button type="button" class="cts-btn-general cts-btn-error btn-push w-full">
|
| 60 |
+
Cancelar la creación
|
| 61 |
+
</button>
|
| 62 |
+
</a>
|
| 63 |
+
</article>
|
| 64 |
+
</form>
|
| 65 |
+
</article>
|
| 66 |
+
</article>
|
| 67 |
+
{% endblock %}
|
| 68 |
+
|
| 69 |
+
{% block extra_js %}
|
| 70 |
+
<script src="{% static 'js/panel-basic.js' %}"></script>
|
| 71 |
+
{% endblock %}
|
tecnicas/views/sessions_config/configuration_panel_basic.py
CHANGED
|
@@ -21,6 +21,8 @@ def configurationPanelBasic(req: HttpRequest):
|
|
| 21 |
response = PanelBasicController.controllGetPF(request=req)
|
| 22 |
elif name_tecnica == "sort":
|
| 23 |
response = PanelBasicController.controllGetSort(request=req)
|
|
|
|
|
|
|
| 24 |
else:
|
| 25 |
response = redirect(
|
| 26 |
reverse("cata_system:seleccion_tecnica") + "?error=Técnica no valida o sin implementar")
|
|
@@ -44,6 +46,9 @@ def configurationPanelBasic(req: HttpRequest):
|
|
| 44 |
elif name_tecnica == "sort":
|
| 45 |
response = PanelBasicController.controllPostSort(
|
| 46 |
request=req, name_tecnica=name_tecnica)
|
|
|
|
|
|
|
|
|
|
| 47 |
else:
|
| 48 |
response = redirect(
|
| 49 |
reverse("cata_system:seleccion_tecnica") + "?error=¡Oh, vaya! Cambio de técnica repentino, vuelve a elegir otra vez")
|
|
|
|
| 21 |
response = PanelBasicController.controllGetPF(request=req)
|
| 22 |
elif name_tecnica == "sort":
|
| 23 |
response = PanelBasicController.controllGetSort(request=req)
|
| 24 |
+
elif name_tecnica == "napping":
|
| 25 |
+
response = PanelBasicController.controllGetNapping(request=req)
|
| 26 |
else:
|
| 27 |
response = redirect(
|
| 28 |
reverse("cata_system:seleccion_tecnica") + "?error=Técnica no valida o sin implementar")
|
|
|
|
| 46 |
elif name_tecnica == "sort":
|
| 47 |
response = PanelBasicController.controllPostSort(
|
| 48 |
request=req, name_tecnica=name_tecnica)
|
| 49 |
+
elif name_tecnica == "napping":
|
| 50 |
+
response = PanelBasicController.controllPostNapping(
|
| 51 |
+
request=req, name_tecnica=name_tecnica)
|
| 52 |
else:
|
| 53 |
response = redirect(
|
| 54 |
reverse("cata_system:seleccion_tecnica") + "?error=¡Oh, vaya! Cambio de técnica repentino, vuelve a elegir otra vez")
|
tecnicas/views/sessions_config/configuration_panel_codes.py
CHANGED
|
@@ -18,8 +18,8 @@ def configurationPanelCodes(req: HttpRequest):
|
|
| 18 |
if name_technique == "escalas":
|
| 19 |
response = PanelCodesController.controllGetEscalas(
|
| 20 |
req, data_basic)
|
| 21 |
-
elif name_technique
|
| 22 |
-
response = PanelCodesController.
|
| 23 |
request=req, data=data_basic, name_technique=name_technique)
|
| 24 |
else:
|
| 25 |
response = redirect(
|
|
@@ -30,17 +30,12 @@ def configurationPanelCodes(req: HttpRequest):
|
|
| 30 |
if name_technique == "escalas":
|
| 31 |
response = PanelCodesController.controllPostEscalas(
|
| 32 |
req, data_basic)
|
| 33 |
-
elif name_technique
|
| 34 |
-
response = PanelCodesController.
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
response = PanelCodesController.controllPostPF(
|
| 40 |
-
request=req)
|
| 41 |
-
elif name_technique == "sort":
|
| 42 |
-
response = PanelCodesController.controllPostSort(
|
| 43 |
-
request=req)
|
| 44 |
else:
|
| 45 |
response = redirect(
|
| 46 |
reverse("cata_system:seleccion_tecnica") + "?error=Técnica no valida")
|
|
|
|
| 18 |
if name_technique == "escalas":
|
| 19 |
response = PanelCodesController.controllGetEscalas(
|
| 20 |
req, data_basic)
|
| 21 |
+
elif name_technique in ["rata", "cata", "perfil flash", "sort", "napping"]:
|
| 22 |
+
response = PanelCodesController.controllGetWithoutOrders(
|
| 23 |
request=req, data=data_basic, name_technique=name_technique)
|
| 24 |
else:
|
| 25 |
response = redirect(
|
|
|
|
| 30 |
if name_technique == "escalas":
|
| 31 |
response = PanelCodesController.controllPostEscalas(
|
| 32 |
req, data_basic)
|
| 33 |
+
elif name_technique in ["rata", "cata"]:
|
| 34 |
+
response = PanelCodesController.controllPostWithWords(
|
| 35 |
+
request=req, name_technique=name_technique)
|
| 36 |
+
elif name_technique in ["perfil flash", "sort", "napping"]:
|
| 37 |
+
response = PanelCodesController.controllPostWithoutOrdersWords(
|
| 38 |
+
request=req, name_technique=name_technique)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 39 |
else:
|
| 40 |
response = redirect(
|
| 41 |
reverse("cata_system:seleccion_tecnica") + "?error=Técnica no valida")
|
tecnicas/views/sessions_config/configuration_panel_words.py
CHANGED
|
@@ -14,12 +14,10 @@ def configurationPanelWords(req: HttpRequest):
|
|
| 14 |
|
| 15 |
basic_data = req.session["form_basic"]
|
| 16 |
name_technique = basic_data["name_tecnica"]
|
| 17 |
-
style_words =
|
| 18 |
-
id=basic_data["estilo_palabras"]).nombre_estilo
|
| 19 |
|
| 20 |
if req.method == "GET":
|
| 21 |
if name_technique == "escalas" or name_technique == "rata" or name_technique == "cata":
|
| 22 |
-
print()
|
| 23 |
if style_words == "atributos":
|
| 24 |
response = PanelWordsController.controllGetEscalasAtributes(
|
| 25 |
req)
|
|
|
|
| 14 |
|
| 15 |
basic_data = req.session["form_basic"]
|
| 16 |
name_technique = basic_data["name_tecnica"]
|
| 17 |
+
style_words = basic_data["estilo_palabras"]
|
|
|
|
| 18 |
|
| 19 |
if req.method == "GET":
|
| 20 |
if name_technique == "escalas" or name_technique == "rata" or name_technique == "cata":
|
|
|
|
| 21 |
if style_words == "atributos":
|
| 22 |
response = PanelWordsController.controllGetEscalasAtributes(
|
| 23 |
req)
|
tecnicas/views/sessions_config/create_session.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
from django.http import HttpRequest, JsonResponse
|
| 2 |
from django.shortcuts import render, redirect
|
| 3 |
from django.urls import reverse
|
| 4 |
-
from tecnicas.controllers import PanelCreateEscalasController, PanelCreateRataController, PanelCreateCataController, PanelCreatePFController, PanelCreateSortController
|
| 5 |
from tecnicas.utils import deleteDataSession
|
| 6 |
|
| 7 |
|
|
@@ -25,6 +25,8 @@ def createSession(req: HttpRequest):
|
|
| 25 |
response = PanelCreatePFController.controllGet(req)
|
| 26 |
elif name_technique == "sort":
|
| 27 |
response = PanelCreateSortController.controllGet(req)
|
|
|
|
|
|
|
| 28 |
else:
|
| 29 |
response = redirect(
|
| 30 |
reverse("cata_system:seleccion_tecnica") + "?error=Técnica no valida")
|
|
@@ -41,6 +43,8 @@ def createSession(req: HttpRequest):
|
|
| 41 |
response = PanelCreatePFController.controllPost(req)
|
| 42 |
elif name_technique == "sort":
|
| 43 |
response = PanelCreateSortController.controllPost(req)
|
|
|
|
|
|
|
| 44 |
else:
|
| 45 |
response = redirect(
|
| 46 |
reverse("cata_system:seleccion_tecnica") + "?error=Técnica no valida")
|
|
|
|
| 1 |
from django.http import HttpRequest, JsonResponse
|
| 2 |
from django.shortcuts import render, redirect
|
| 3 |
from django.urls import reverse
|
| 4 |
+
from tecnicas.controllers import PanelCreateEscalasController, PanelCreateRataController, PanelCreateCataController, PanelCreatePFController, PanelCreateSortController, PanelCreateNappingController
|
| 5 |
from tecnicas.utils import deleteDataSession
|
| 6 |
|
| 7 |
|
|
|
|
| 25 |
response = PanelCreatePFController.controllGet(req)
|
| 26 |
elif name_technique == "sort":
|
| 27 |
response = PanelCreateSortController.controllGet(req)
|
| 28 |
+
elif name_technique == "napping":
|
| 29 |
+
response = PanelCreateNappingController.controllGet(req)
|
| 30 |
else:
|
| 31 |
response = redirect(
|
| 32 |
reverse("cata_system:seleccion_tecnica") + "?error=Técnica no valida")
|
|
|
|
| 43 |
response = PanelCreatePFController.controllPost(req)
|
| 44 |
elif name_technique == "sort":
|
| 45 |
response = PanelCreateSortController.controllPost(req)
|
| 46 |
+
elif name_technique == "napping":
|
| 47 |
+
response = PanelCreateNappingController.controllPost(req)
|
| 48 |
else:
|
| 49 |
response = redirect(
|
| 50 |
reverse("cata_system:seleccion_tecnica") + "?error=Técnica no valida")
|