Spaces:
Sleeping
Sleeping
Configuracion basica y configuracion de tags configuradas para otros tipo de tecnica
Browse files- tecnicas/controllers/__init__.py +4 -1
- tecnicas/controllers/models_controller/tecnica_controller.py +1 -1
- tecnicas/controllers/views_controller/create_session/panel_basic_controller.py +42 -0
- tecnicas/controllers/views_controller/create_session/panel_tags_controller.py +71 -0
- tecnicas/forms/sesion_basic_form.py +2 -15
- tecnicas/templates/tecnicas/create_sesion/configuracion-panel-basic.html +2 -2
- tecnicas/templates/tecnicas/create_sesion/seleccion-tecnica.html +1 -1
- tecnicas/views/sessions_config/configuration_panel_basic.py +25 -35
- tecnicas/views/sessions_config/configuration_panel_tags.py +16 -36
- tecnicas/views/sessions_config/seleccion_tecnica.py +1 -2
tecnicas/controllers/__init__.py
CHANGED
|
@@ -18,4 +18,7 @@ from .views_controller.main_tester_form_controller import MainTesterFormControll
|
|
| 18 |
from .views_controller.api_rating_controller import ApiRatingController
|
| 19 |
from .views_controller.monitor_sesion_controller import MonitorSesionController
|
| 20 |
from .views_controller.tester_list_controller import TesterListController
|
| 21 |
-
from .views_controller.list_sessions_tester_controller import ListSessionsTesterController
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
from .views_controller.api_rating_controller import ApiRatingController
|
| 19 |
from .views_controller.monitor_sesion_controller import MonitorSesionController
|
| 20 |
from .views_controller.tester_list_controller import TesterListController
|
| 21 |
+
from .views_controller.list_sessions_tester_controller import ListSessionsTesterController
|
| 22 |
+
|
| 23 |
+
from .views_controller.create_session.panel_basic_controller import PanelBasicController
|
| 24 |
+
from .views_controller.create_session.panel_tags_controller import PanelTagsController
|
tecnicas/controllers/models_controller/tecnica_controller.py
CHANGED
|
@@ -15,7 +15,7 @@ class TecnicaController():
|
|
| 15 |
|
| 16 |
def setTechniqueFromBasicData(self, basic):
|
| 17 |
self.technique = Tecnica(
|
| 18 |
-
tipo_tecnica=TipoTecnica.objects.get(
|
| 19 |
id_estilo=EstiloPalabra.objects.get(id=basic["estilo_palabras"]),
|
| 20 |
repeticiones_max=basic["numero_repeticiones"] or 0,
|
| 21 |
limite_catadores=basic["numero_catadores"],
|
|
|
|
| 15 |
|
| 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(id=basic["estilo_palabras"]),
|
| 20 |
repeticiones_max=basic["numero_repeticiones"] or 0,
|
| 21 |
limite_catadores=basic["numero_catadores"],
|
tecnicas/controllers/views_controller/create_session/panel_basic_controller.py
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from tecnicas.forms import SesionBasicForm
|
| 2 |
+
from django.http import HttpRequest
|
| 3 |
+
from django.shortcuts import redirect, render
|
| 4 |
+
from django.urls import reverse
|
| 5 |
+
|
| 6 |
+
|
| 7 |
+
class PanelBasicController():
|
| 8 |
+
def __init__(self):
|
| 9 |
+
pass
|
| 10 |
+
|
| 11 |
+
@staticmethod
|
| 12 |
+
def controllGetConvencional(request: HttpRequest):
|
| 13 |
+
form_sesion = SesionBasicForm()
|
| 14 |
+
response = render(
|
| 15 |
+
request, "tecnicas/create_sesion/configuracion-panel-basic.html", {"form_sesion": form_sesion})
|
| 16 |
+
return response
|
| 17 |
+
|
| 18 |
+
@staticmethod
|
| 19 |
+
def controllPostConvencional(request: HttpRequest, name_tecnica: str):
|
| 20 |
+
try:
|
| 21 |
+
form = SesionBasicForm(request.POST)
|
| 22 |
+
|
| 23 |
+
if form.is_valid():
|
| 24 |
+
values = {}
|
| 25 |
+
for name, value in form.cleaned_data.items():
|
| 26 |
+
if name == "estilo_palabras" or name == "tipo_escala":
|
| 27 |
+
values[name] = value.id
|
| 28 |
+
else:
|
| 29 |
+
values[name] = value
|
| 30 |
+
|
| 31 |
+
values["name_tecnica"] = name_tecnica
|
| 32 |
+
request.session['form_basic'] = values
|
| 33 |
+
response = redirect(
|
| 34 |
+
reverse("cata_system:panel_configuracion_tags"))
|
| 35 |
+
else:
|
| 36 |
+
response = render(request, "tecnicas/create_sesion/configuracion-panel-basic.html", {
|
| 37 |
+
"form_sesion": form, "error": "Información no valida"})
|
| 38 |
+
except KeyError:
|
| 39 |
+
response = redirect(reverse(
|
| 40 |
+
"cata_system:seleccion_tecnica") + "?error=error en datos de configuracion")
|
| 41 |
+
|
| 42 |
+
return response
|
tecnicas/controllers/views_controller/create_session/panel_tags_controller.py
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from django.http import HttpRequest
|
| 2 |
+
from django.shortcuts import redirect, render
|
| 3 |
+
from django.urls import reverse
|
| 4 |
+
from tecnicas.forms import SesionTagsForm, EtiquetaForm
|
| 5 |
+
from tecnicas.models import TipoEscala
|
| 6 |
+
|
| 7 |
+
|
| 8 |
+
class PanelTagsController():
|
| 9 |
+
def __init__(self):
|
| 10 |
+
pass
|
| 11 |
+
|
| 12 |
+
@staticmethod
|
| 13 |
+
def controllGetConvencional(request: HttpRequest, data):
|
| 14 |
+
(
|
| 15 |
+
type_scale,
|
| 16 |
+
tamano_escala,
|
| 17 |
+
form_new_etiqueta
|
| 18 |
+
) = PanelTagsController.defineInfoScale(data)
|
| 19 |
+
|
| 20 |
+
form_etiqutas = SesionTagsForm(
|
| 21 |
+
longitud=tamano_escala, tipo_escala=type_scale.nombre_escala)
|
| 22 |
+
|
| 23 |
+
context_tags = {
|
| 24 |
+
"form_tags": form_etiqutas,
|
| 25 |
+
"form_new_tag": form_new_etiqueta
|
| 26 |
+
}
|
| 27 |
+
|
| 28 |
+
return render(request, "tecnicas/create_sesion/configuracion-panel-tags.html", context_tags)
|
| 29 |
+
|
| 30 |
+
@staticmethod
|
| 31 |
+
def controllPostConvencional(request: HttpRequest, data):
|
| 32 |
+
(
|
| 33 |
+
type_scale,
|
| 34 |
+
tamano_escala,
|
| 35 |
+
form_new_etiqueta
|
| 36 |
+
) = PanelTagsController.defineInfoScale(data)
|
| 37 |
+
|
| 38 |
+
values = {}
|
| 39 |
+
form = SesionTagsForm(request.POST, longitud=tamano_escala,
|
| 40 |
+
tipo_escala=type_scale.nombre_escala)
|
| 41 |
+
|
| 42 |
+
context_tags = {
|
| 43 |
+
"form_tags": form,
|
| 44 |
+
"form_new_tag": form_new_etiqueta
|
| 45 |
+
}
|
| 46 |
+
|
| 47 |
+
if form.is_valid():
|
| 48 |
+
for name, value in form.cleaned_data.items():
|
| 49 |
+
values[name] = value.id
|
| 50 |
+
|
| 51 |
+
request.session["form_tags"] = values
|
| 52 |
+
response = redirect(
|
| 53 |
+
reverse("cata_system:panel_configuracion_codes"))
|
| 54 |
+
else:
|
| 55 |
+
context_tags["error"] = "ha ocurrido un error"
|
| 56 |
+
response = render(
|
| 57 |
+
request, "tecnicas/create_sesion/configuracion-panel-tags.html", context_tags)
|
| 58 |
+
|
| 59 |
+
return response
|
| 60 |
+
|
| 61 |
+
@staticmethod
|
| 62 |
+
def defineInfoScale(data):
|
| 63 |
+
type_scale = TipoEscala.objects.get(pk=data["tipo_escala"])
|
| 64 |
+
tamano_escala = data["tamano_escala"]
|
| 65 |
+
form_new_etiqueta = EtiquetaForm()
|
| 66 |
+
|
| 67 |
+
return (
|
| 68 |
+
type_scale,
|
| 69 |
+
tamano_escala,
|
| 70 |
+
form_new_etiqueta
|
| 71 |
+
)
|
tecnicas/forms/sesion_basic_form.py
CHANGED
|
@@ -8,8 +8,6 @@ class SesionBasicForm(forms.Form):
|
|
| 8 |
sizes_structure = [5, 7, 9]
|
| 9 |
sizes_continue = [9, 13, 15]
|
| 10 |
|
| 11 |
-
id_tecnica = forms.IntegerField(widget=forms.HiddenInput())
|
| 12 |
-
|
| 13 |
nombre_sesion = forms.CharField(max_length=255, widget=forms.TextInput(attrs={
|
| 14 |
"class": "bg-surface-ligt border-b-1 text-center w-full p-1",
|
| 15 |
"name": "nombre_sesion",
|
|
@@ -36,7 +34,7 @@ class SesionBasicForm(forms.Form):
|
|
| 36 |
"placeholder": "Este campo es opcional"
|
| 37 |
}), required=False)
|
| 38 |
|
| 39 |
-
def __init__(self, *args,
|
| 40 |
super().__init__(*args, **kwargs)
|
| 41 |
|
| 42 |
self.fields['estilo_palabras'] = forms.ModelChoiceField(queryset=EstiloPalabra.objects.all(), widget=forms.RadioSelect(attrs={
|
|
@@ -49,11 +47,7 @@ class SesionBasicForm(forms.Form):
|
|
| 49 |
|
| 50 |
self.fields['tamano_escala'] = forms.IntegerField(widget=forms.HiddenInput(attrs={
|
| 51 |
"class": "cts-size-input",
|
| 52 |
-
}), required=True
|
| 53 |
-
|
| 54 |
-
if id_tecnica_new != 0:
|
| 55 |
-
self.fields['id_tecnica'] = forms.IntegerField(
|
| 56 |
-
initial=id_tecnica_new, widget=forms.HiddenInput())
|
| 57 |
|
| 58 |
def clean(self):
|
| 59 |
data_clean = super().clean()
|
|
@@ -73,10 +67,3 @@ class SesionBasicForm(forms.Form):
|
|
| 73 |
self.add_error("tamano_escala", "El tamaño de la escala no aplica")
|
| 74 |
elif escala.nombre_escala == "continua" and not self.sizes_continue.__contains__(tamano_escala):
|
| 75 |
self.add_error("tamano_escala", "El tamaño de la escala no aplica")
|
| 76 |
-
|
| 77 |
-
id_tecnica = data_clean.get("id_tecnica")
|
| 78 |
-
|
| 79 |
-
try:
|
| 80 |
-
tecnica = TipoTecnica.objects.get(pk=id_tecnica)
|
| 81 |
-
except (ValueError, TipoTecnica.DoesNotExist):
|
| 82 |
-
return data_clean
|
|
|
|
| 8 |
sizes_structure = [5, 7, 9]
|
| 9 |
sizes_continue = [9, 13, 15]
|
| 10 |
|
|
|
|
|
|
|
| 11 |
nombre_sesion = forms.CharField(max_length=255, widget=forms.TextInput(attrs={
|
| 12 |
"class": "bg-surface-ligt border-b-1 text-center w-full p-1",
|
| 13 |
"name": "nombre_sesion",
|
|
|
|
| 34 |
"placeholder": "Este campo es opcional"
|
| 35 |
}), required=False)
|
| 36 |
|
| 37 |
+
def __init__(self, *args, **kwargs):
|
| 38 |
super().__init__(*args, **kwargs)
|
| 39 |
|
| 40 |
self.fields['estilo_palabras'] = forms.ModelChoiceField(queryset=EstiloPalabra.objects.all(), widget=forms.RadioSelect(attrs={
|
|
|
|
| 47 |
|
| 48 |
self.fields['tamano_escala'] = forms.IntegerField(widget=forms.HiddenInput(attrs={
|
| 49 |
"class": "cts-size-input",
|
| 50 |
+
}), required=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 51 |
|
| 52 |
def clean(self):
|
| 53 |
data_clean = super().clean()
|
|
|
|
| 67 |
self.add_error("tamano_escala", "El tamaño de la escala no aplica")
|
| 68 |
elif escala.nombre_escala == "continua" and not self.sizes_continue.__contains__(tamano_escala):
|
| 69 |
self.add_error("tamano_escala", "El tamaño de la escala no aplica")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
tecnicas/templates/tecnicas/create_sesion/configuracion-panel-basic.html
CHANGED
|
@@ -13,8 +13,8 @@
|
|
| 13 |
<hr>
|
| 14 |
<form method="post" action="" class="[&>article]:not-last:mb-4 [&>article]:not-first:pt-4 [&>article]:px-6">
|
| 15 |
{% csrf_token %}
|
| 16 |
-
<label for="form_sesion.
|
| 17 |
-
{{ form_sesion.
|
| 18 |
</label>
|
| 19 |
|
| 20 |
<article>
|
|
|
|
| 13 |
<hr>
|
| 14 |
<form method="post" action="" class="[&>article]:not-last:mb-4 [&>article]:not-first:pt-4 [&>article]:px-6">
|
| 15 |
{% csrf_token %}
|
| 16 |
+
<label for="form_sesion.name_tecnica.id_for_label" class="hidden">
|
| 17 |
+
{{ form_sesion.name_tecnica }}
|
| 18 |
</label>
|
| 19 |
|
| 20 |
<article>
|
tecnicas/templates/tecnicas/create_sesion/seleccion-tecnica.html
CHANGED
|
@@ -33,7 +33,7 @@
|
|
| 33 |
<section
|
| 34 |
class="modal-list-{{ cate }} flex flex-col text-lg bg-surface-ligt p-4 pr-6 pl-8 sm:pl-12 z-10 -translate-y-1 rounded-b-2xl *:not-last:mb-4 transition-all duration-1000 hidden w-full">
|
| 35 |
{% for tecnica in tecnicas %}
|
| 36 |
-
<a href="{% url 'cata_system:panel_configuracion_basic'%}?
|
| 37 |
<button
|
| 38 |
class="cts-btn-secondary btn-push rounded-lg border-b-0 border-l-4 border-gray-700 px-3 py-2 w-full text-left font-bold uppercase">
|
| 39 |
{{ tecnica.nombre_tecnica }}
|
|
|
|
| 33 |
<section
|
| 34 |
class="modal-list-{{ cate }} flex flex-col text-lg bg-surface-ligt p-4 pr-6 pl-8 sm:pl-12 z-10 -translate-y-1 rounded-b-2xl *:not-last:mb-4 transition-all duration-1000 hidden w-full">
|
| 35 |
{% for tecnica in tecnicas %}
|
| 36 |
+
<a href="{% url 'cata_system:panel_configuracion_basic'%}?name_tecnica={{ tecnica }}">
|
| 37 |
<button
|
| 38 |
class="cts-btn-secondary btn-push rounded-lg border-b-0 border-l-4 border-gray-700 px-3 py-2 w-full text-left font-bold uppercase">
|
| 39 |
{{ tecnica.nombre_tecnica }}
|
tecnicas/views/sessions_config/configuration_panel_basic.py
CHANGED
|
@@ -1,8 +1,8 @@
|
|
| 1 |
from django.shortcuts import render, redirect
|
| 2 |
-
from django.http import HttpRequest
|
| 3 |
from django.urls import reverse
|
| 4 |
-
from
|
| 5 |
-
from
|
| 6 |
|
| 7 |
|
| 8 |
def configurationPanelBasic(req: HttpRequest):
|
|
@@ -17,36 +17,26 @@ def configurationPanelBasic(req: HttpRequest):
|
|
| 17 |
if key in req.session:
|
| 18 |
del req.session[key]
|
| 19 |
|
| 20 |
-
if req.method == "
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
values = {}
|
| 26 |
-
|
| 27 |
-
for name, value in form.cleaned_data.items():
|
| 28 |
-
if name == "estilo_palabras" or name == "tipo_escala":
|
| 29 |
-
values[name] = value.id
|
| 30 |
-
else:
|
| 31 |
-
values[name] = value
|
| 32 |
-
|
| 33 |
-
req.session['form_basic'] = values
|
| 34 |
-
return redirect(reverse("cata_system:panel_configuracion_tags"))
|
| 35 |
-
except KeyError:
|
| 36 |
-
return redirect(reverse("cata_system:seleccion_tecnica") + "?error=error en datos de configuracion")
|
| 37 |
-
|
| 38 |
-
return render(req, "tecnicas/create_sesion/configuracion-panel-basic.html", {"form_sesion": form, "error": "Ha ocurrido un error al continuar al siguiente paso."})
|
| 39 |
-
elif req.method == "GET":
|
| 40 |
-
try:
|
| 41 |
-
id_tecnica = req.GET["id_tecnica"]
|
| 42 |
-
tecnica = TipoTecnica.objects.get(pk=id_tecnica)
|
| 43 |
-
except KeyError:
|
| 44 |
-
return redirect(reverse("cata_system:seleccion_tecnica") + "?error=tecnica_no_establecida")
|
| 45 |
-
except (ValueError, TipoTecnica.DoesNotExist):
|
| 46 |
-
return redirect(reverse("cata_system:seleccion_tecnica") + "?error=tecnica_no_establecida")
|
| 47 |
-
|
| 48 |
-
if tecnica:
|
| 49 |
-
form_sesion = SesionBasicForm(id_tecnica_new=id_tecnica)
|
| 50 |
-
return render(req, "tecnicas/create_sesion/configuracion-panel-basic.html", {"form_sesion": form_sesion})
|
| 51 |
else:
|
| 52 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
from django.shortcuts import render, redirect
|
| 2 |
+
from django.http import HttpRequest, JsonResponse
|
| 3 |
from django.urls import reverse
|
| 4 |
+
from tecnicas.forms import SesionBasicForm
|
| 5 |
+
from tecnicas.controllers import PanelBasicController
|
| 6 |
|
| 7 |
|
| 8 |
def configurationPanelBasic(req: HttpRequest):
|
|
|
|
| 17 |
if key in req.session:
|
| 18 |
del req.session[key]
|
| 19 |
|
| 20 |
+
if req.method == "GET":
|
| 21 |
+
name_tecnica = req.GET["name_tecnica"]
|
| 22 |
+
|
| 23 |
+
if name_tecnica == "escalas":
|
| 24 |
+
response = PanelBasicController.controllGetConvencional(request=req)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
else:
|
| 26 |
+
response = redirect(
|
| 27 |
+
reverse("cata_system:seleccion_tecnica") + "?error=Técnica no valida o sin implementar")
|
| 28 |
+
|
| 29 |
+
return response
|
| 30 |
+
elif req.method == "POST":
|
| 31 |
+
name_tecnica = req.GET["name_tecnica"]
|
| 32 |
+
|
| 33 |
+
if name_tecnica == "escalas":
|
| 34 |
+
response = PanelBasicController.controllPostConvencional(
|
| 35 |
+
request=req, name_tecnica=name_tecnica)
|
| 36 |
+
else:
|
| 37 |
+
response = redirect(
|
| 38 |
+
reverse("cata_system:seleccion_tecnica") + "?error=¡Oh, vaya! Cambio de técnica repentino, vuelve a elegir otra vez")
|
| 39 |
+
|
| 40 |
+
return response
|
| 41 |
+
else:
|
| 42 |
+
return JsonResponse({"message": "Método no permitido"})
|
tecnicas/views/sessions_config/configuration_panel_tags.py
CHANGED
|
@@ -1,46 +1,26 @@
|
|
| 1 |
-
from django.http import HttpRequest
|
| 2 |
-
from django.shortcuts import redirect
|
| 3 |
from django.urls import reverse
|
| 4 |
-
from tecnicas.
|
| 5 |
-
from tecnicas.models import TipoEscala
|
| 6 |
|
| 7 |
|
| 8 |
def configurationPanelTags(req: HttpRequest):
|
| 9 |
-
basic_data = req.session.get("form_basic"
|
| 10 |
-
|
| 11 |
if not basic_data:
|
| 12 |
return redirect(reverse('cata_system:panel_configuracion_basic'))
|
| 13 |
|
| 14 |
-
type_scale = TipoEscala.objects.get(pk=basic_data["tipo_escala"])
|
| 15 |
-
tamano_escala = basic_data["tamano_escala"]
|
| 16 |
-
form_new_etiqueta = EtiquetaForm()
|
| 17 |
-
|
| 18 |
if req.method == "GET":
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
}
|
| 26 |
|
| 27 |
-
return
|
| 28 |
elif req.method == "POST":
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
"form_tags": form,
|
| 35 |
-
"form_new_tag": form_new_etiqueta
|
| 36 |
-
}
|
| 37 |
-
|
| 38 |
-
if form.is_valid():
|
| 39 |
-
for name, value in form.cleaned_data.items():
|
| 40 |
-
values[name] = value.id
|
| 41 |
-
|
| 42 |
-
req.session["form_tags"] = values
|
| 43 |
-
return redirect(reverse("cata_system:panel_configuracion_codes"))
|
| 44 |
-
else:
|
| 45 |
-
context_tags["error"] = "ha ocurrido un error"
|
| 46 |
-
return render(req, "tecnicas/create_sesion/configuracion-panel-tags.html", context_tags)
|
|
|
|
| 1 |
+
from django.http import HttpRequest, JsonResponse
|
| 2 |
+
from django.shortcuts import redirect
|
| 3 |
from django.urls import reverse
|
| 4 |
+
from tecnicas.controllers import PanelTagsController
|
|
|
|
| 5 |
|
| 6 |
|
| 7 |
def configurationPanelTags(req: HttpRequest):
|
| 8 |
+
basic_data = req.session.get("form_basic")
|
|
|
|
| 9 |
if not basic_data:
|
| 10 |
return redirect(reverse('cata_system:panel_configuracion_basic'))
|
| 11 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
if req.method == "GET":
|
| 13 |
+
if basic_data["name_tecnica"] == "escalas":
|
| 14 |
+
response = PanelTagsController.controllGetConvencional(
|
| 15 |
+
request=req, data=basic_data)
|
| 16 |
+
else:
|
| 17 |
+
response = redirect(
|
| 18 |
+
reverse("cata_system:seleccion_tecnica") + "?error=Técnica no valida")
|
|
|
|
| 19 |
|
| 20 |
+
return response
|
| 21 |
elif req.method == "POST":
|
| 22 |
+
response = PanelTagsController.controllPostConvencional(
|
| 23 |
+
request=req, data=basic_data)
|
| 24 |
+
return response
|
| 25 |
+
else:
|
| 26 |
+
return JsonResponse({"message": "Método no permitido"})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
tecnicas/views/sessions_config/seleccion_tecnica.py
CHANGED
|
@@ -1,7 +1,6 @@
|
|
| 1 |
from django.shortcuts import render
|
| 2 |
from django.http import HttpRequest
|
| 3 |
-
|
| 4 |
-
from ...controllers import TecnicaController
|
| 5 |
|
| 6 |
def selecionTecnica(req:HttpRequest):
|
| 7 |
tipos = TecnicaController.getTypesTechnique()
|
|
|
|
| 1 |
from django.shortcuts import render
|
| 2 |
from django.http import HttpRequest
|
| 3 |
+
from tecnicas.controllers import TecnicaController
|
|
|
|
| 4 |
|
| 5 |
def selecionTecnica(req:HttpRequest):
|
| 6 |
tipos = TecnicaController.getTypesTechnique()
|