Spaces:
Sleeping
Sleeping
Paso de valores del form basic a form tags
Browse files- tecnicas/forms/__init__.py +2 -1
- tecnicas/forms/{conf_sesion_form_start.py → sesion_basic.py} +36 -21
- tecnicas/forms/sesion_tags.py +14 -0
- tecnicas/templates/tecnicas/configuracion-panel-basic.html +11 -2
- tecnicas/templates/tecnicas/configuracion-panel-tags.html +36 -58
- tecnicas/views/configuration_panel_basic.py +16 -6
- tecnicas/views/configuration_panel_tags.py +10 -2
tecnicas/forms/__init__.py
CHANGED
|
@@ -1 +1,2 @@
|
|
| 1 |
-
from .
|
|
|
|
|
|
| 1 |
+
from .sesion_basic import SesionBasicForm
|
| 2 |
+
from .sesion_tags import SesionTagsForm
|
tecnicas/forms/{conf_sesion_form_start.py → sesion_basic.py}
RENAMED
|
@@ -1,36 +1,45 @@
|
|
| 1 |
from django import forms
|
| 2 |
|
| 3 |
from ..models import TipoEscala
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
|
| 5 |
-
class SesionFirtsForm(forms.Form):
|
| 6 |
nombre_sesion = forms.CharField(max_length=255, widget=forms.TextInput(attrs={
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
|
| 12 |
numero_productos = forms.IntegerField(widget=forms.NumberInput(attrs={
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
|
| 17 |
numero_jueces = forms.IntegerField(widget=forms.NumberInput(attrs={
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
numero_repeticiones = forms.IntegerField(widget=forms.NumberInput(attrs={
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
|
| 27 |
tipo_escala = forms.ModelChoiceField(queryset=TipoEscala.objects.all(), widget=forms.RadioSelect(attrs={
|
| 28 |
-
|
| 29 |
-
|
| 30 |
|
| 31 |
tamano_escala = forms.IntegerField(widget=forms.NumberInput(attrs={
|
| 32 |
-
|
| 33 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 34 |
|
| 35 |
def clean(self):
|
| 36 |
data_clean = super().clean()
|
|
@@ -44,6 +53,7 @@ class SesionFirtsForm(forms.Form):
|
|
| 44 |
try:
|
| 45 |
escala = TipoEscala.objects.get(pk=escala)
|
| 46 |
except (ValueError, TipoEscala.DoesNotExist):
|
|
|
|
| 47 |
self.add_error("tipo_escala", "Escala no valida")
|
| 48 |
return data_clean
|
| 49 |
|
|
@@ -53,5 +63,10 @@ class SesionFirtsForm(forms.Form):
|
|
| 53 |
self.add_error("tamano_escala", "El tamaño de la escala no aplica")
|
| 54 |
elif escala.nombre_escala == "continua" and not sizes_continua.__contains__(tamano_escala):
|
| 55 |
self.add_error("tamano_escala", "El tamaño de la escala no aplica")
|
| 56 |
-
|
| 57 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
from django import forms
|
| 2 |
|
| 3 |
from ..models import TipoEscala
|
| 4 |
+
from ..models import TipoTecnica
|
| 5 |
+
|
| 6 |
+
class SesionBasicForm(forms.Form):
|
| 7 |
+
id_tecnica = forms.IntegerField(widget=forms.HiddenInput())
|
| 8 |
|
|
|
|
| 9 |
nombre_sesion = forms.CharField(max_length=255, widget=forms.TextInput(attrs={
|
| 10 |
+
"class": "bg-gray-200 border-b-1 text-center w-full p-1",
|
| 11 |
+
"name": "nombre_sesion",
|
| 12 |
+
"placeholder": "Ej. Mermelada de mango picante"
|
| 13 |
+
}), required=False)
|
| 14 |
|
| 15 |
numero_productos = forms.IntegerField(widget=forms.NumberInput(attrs={
|
| 16 |
+
"class": "bg-gray-200 p-1 border-b-1 text-center w-full",
|
| 17 |
+
"placeholder": "Solo números"
|
| 18 |
+
}), required=True)
|
| 19 |
|
| 20 |
numero_jueces = forms.IntegerField(widget=forms.NumberInput(attrs={
|
| 21 |
+
"class": "bg-gray-200 p-1 border-b-1 text-center w-full",
|
| 22 |
+
"placeholder": "Solo números"
|
| 23 |
+
}), required=True)
|
| 24 |
+
|
| 25 |
numero_repeticiones = forms.IntegerField(widget=forms.NumberInput(attrs={
|
| 26 |
+
"class": "bg-gray-200 p-1 border-b-1 text-center w-full",
|
| 27 |
+
"placeholder": "Solo números"
|
| 28 |
+
}), required=True)
|
| 29 |
|
| 30 |
tipo_escala = forms.ModelChoiceField(queryset=TipoEscala.objects.all(), 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=TipoEscala.objects.first())
|
| 33 |
|
| 34 |
tamano_escala = forms.IntegerField(widget=forms.NumberInput(attrs={
|
| 35 |
+
"class": "bg-gray-200 p-1 border-b-1 text-center w-full",
|
| 36 |
+
}), required=True, min_value=5)
|
| 37 |
+
|
| 38 |
+
def __init__(self, *args, id_tecnica_new=0, **kwargs):
|
| 39 |
+
super().__init__(*args, **kwargs)
|
| 40 |
+
|
| 41 |
+
if id_tecnica_new != 0:
|
| 42 |
+
self.fields['id_tecnica'] = forms.IntegerField(initial=id_tecnica_new, widget=forms.HiddenInput())
|
| 43 |
|
| 44 |
def clean(self):
|
| 45 |
data_clean = super().clean()
|
|
|
|
| 53 |
try:
|
| 54 |
escala = TipoEscala.objects.get(pk=escala)
|
| 55 |
except (ValueError, TipoEscala.DoesNotExist):
|
| 56 |
+
print("Escala no valida")
|
| 57 |
self.add_error("tipo_escala", "Escala no valida")
|
| 58 |
return data_clean
|
| 59 |
|
|
|
|
| 63 |
self.add_error("tamano_escala", "El tamaño de la escala no aplica")
|
| 64 |
elif escala.nombre_escala == "continua" and not sizes_continua.__contains__(tamano_escala):
|
| 65 |
self.add_error("tamano_escala", "El tamaño de la escala no aplica")
|
| 66 |
+
|
| 67 |
+
id_tecnica = data_clean.get("id_tecnica")
|
| 68 |
+
|
| 69 |
+
try:
|
| 70 |
+
tecnica = TipoTecnica.objects.get(pk=id_tecnica)
|
| 71 |
+
except (ValueError, TipoTecnica.DoesNotExist):
|
| 72 |
+
return data_clean
|
tecnicas/forms/sesion_tags.py
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from django import forms
|
| 2 |
+
from django.shortcuts import redirect
|
| 3 |
+
from django.urls import reverse
|
| 4 |
+
|
| 5 |
+
from ..models import Etiqueta
|
| 6 |
+
|
| 7 |
+
class SesionTagsForm(forms.Form):
|
| 8 |
+
def __init__(self, *args, segmentos=None, **kwargs):
|
| 9 |
+
super().__init__(*args, **kwargs)
|
| 10 |
+
|
| 11 |
+
for i in range(segmentos):
|
| 12 |
+
self.fields[f'segmento_{i}'] = forms.ModelChoiceField(queryset=Etiqueta.objects.all(), required=True,label=f"segmento {i+1}", empty_label="Selecione opcion", widget=forms.Select(attrs={
|
| 13 |
+
"class":"ct-select-op p-1 rounded bg-gray-200 [*]:capitalize"
|
| 14 |
+
}))
|
tecnicas/templates/tecnicas/configuracion-panel-basic.html
CHANGED
|
@@ -16,9 +16,17 @@
|
|
| 16 |
<article class="w-full flex flex-col justify-center items-center bg-gray-600 my-10">
|
| 17 |
<article class="flex flex-col gap-4 bg-gray-400 md:p-10 p-5 rounded-2xl lg:w-4xl w-full">
|
| 18 |
<h1 class="text-center font-bold text-4xl">Panel de configuración</h1>
|
|
|
|
|
|
|
|
|
|
| 19 |
<hr>
|
| 20 |
<form method="post" action="" class="[&>article]:not-last:mb-4 [&>article]:not-first:pt-4 [&>article]:px-6">
|
| 21 |
{% csrf_token %}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
<article>
|
| 23 |
<h2 class="text-2xl mb-2 font-bold">Información Basica</h2>
|
| 24 |
<section class="flex justify-center items-center">
|
|
@@ -70,7 +78,8 @@
|
|
| 70 |
{{ form_sesion.tamano_escala }}
|
| 71 |
</label>
|
| 72 |
{% if form_sesion.tamano_escala.errors %}
|
| 73 |
-
<article
|
|
|
|
| 74 |
{{ form_sesion.tamano_escala.errors }}
|
| 75 |
</article>
|
| 76 |
{% endif %}
|
|
@@ -108,7 +117,7 @@
|
|
| 108 |
labels = document.getElementsByClassName("ct-radio-escala")
|
| 109 |
pSize = document.getElementsByClassName("ct-size-scale").item(0).getElementsByTagName("p")[0]
|
| 110 |
iSize = document.getElementsByClassName("ct-size-scale").item(0).getElementsByTagName("input")[0]
|
| 111 |
-
|
| 112 |
pSize.textContent = descriptons["estructurada"][0]
|
| 113 |
iSize.placeholder = descriptons["estructurada"][1]
|
| 114 |
|
|
|
|
| 16 |
<article class="w-full flex flex-col justify-center items-center bg-gray-600 my-10">
|
| 17 |
<article class="flex flex-col gap-4 bg-gray-400 md:p-10 p-5 rounded-2xl lg:w-4xl w-full">
|
| 18 |
<h1 class="text-center font-bold text-4xl">Panel de configuración</h1>
|
| 19 |
+
{% if error %}
|
| 20 |
+
<p class="text-sm bg-red-200 text-center">{{ error }}</p>
|
| 21 |
+
{% endif %}
|
| 22 |
<hr>
|
| 23 |
<form method="post" action="" class="[&>article]:not-last:mb-4 [&>article]:not-first:pt-4 [&>article]:px-6">
|
| 24 |
{% csrf_token %}
|
| 25 |
+
|
| 26 |
+
<label for="form_sesion.id_tecnica.id_for_label" class="hidden">
|
| 27 |
+
{{ form_sesion.id_tecnica }}
|
| 28 |
+
</label>
|
| 29 |
+
|
| 30 |
<article>
|
| 31 |
<h2 class="text-2xl mb-2 font-bold">Información Basica</h2>
|
| 32 |
<section class="flex justify-center items-center">
|
|
|
|
| 78 |
{{ form_sesion.tamano_escala }}
|
| 79 |
</label>
|
| 80 |
{% if form_sesion.tamano_escala.errors %}
|
| 81 |
+
<article
|
| 82 |
+
class="w-fit rounded px-2 py-0.5 text-center text-white text-sm font-medium tracking-wide bg-red-500">
|
| 83 |
{{ form_sesion.tamano_escala.errors }}
|
| 84 |
</article>
|
| 85 |
{% endif %}
|
|
|
|
| 117 |
labels = document.getElementsByClassName("ct-radio-escala")
|
| 118 |
pSize = document.getElementsByClassName("ct-size-scale").item(0).getElementsByTagName("p")[0]
|
| 119 |
iSize = document.getElementsByClassName("ct-size-scale").item(0).getElementsByTagName("input")[0]
|
| 120 |
+
|
| 121 |
pSize.textContent = descriptons["estructurada"][0]
|
| 122 |
iSize.placeholder = descriptons["estructurada"][1]
|
| 123 |
|
tecnicas/templates/tecnicas/configuracion-panel-tags.html
CHANGED
|
@@ -11,15 +11,7 @@
|
|
| 11 |
- Presentar un orden basico segun el numero de catadores y los productos, esta se le muestra el presentador
|
| 12 |
-->
|
| 13 |
|
| 14 |
-
|
| 15 |
-
<article class="w-full flex flex-col justify-center items-center bg-gray-600 my-10">
|
| 16 |
-
<article class="flex flex-col gap-4 bg-gray-400 md:p-10 p-5 rounded-2xl lg:w-4xl w-full">
|
| 17 |
-
<h1 class="text-center font-bold text-4xl">Panel de configuración</h1>
|
| 18 |
-
<hr>
|
| 19 |
-
<form method="post" action="" class="[&>article]:not-last:mb-4 [&>article]:not-first:pt-4 [&>article]:px-6">
|
| 20 |
-
{% csrf_token %}
|
| 21 |
-
<article class="bg-gray-500 p-4 flex flex-col gap-2">
|
| 22 |
-
<div class="flex flex-row justify-center items-center gap-5 text-lg">
|
| 23 |
<p class="font-medium p-1 px-3 bg-gray-200">Segmento 1</p>
|
| 24 |
<label for="etiquta_1">
|
| 25 |
<select name="etiquta_1" class="p-1 rounded bg-gray-200 [*]:capitalize" id="etiquta_1" required>
|
|
@@ -31,59 +23,28 @@
|
|
| 31 |
</select>
|
| 32 |
</label>
|
| 33 |
<button type="button" class="p-1 rounded-lg bg-gray-200 active:bg-gray-400">➕</button>
|
| 34 |
-
</div>
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
</label>
|
| 46 |
-
<button type="button" class="p-1 rounded-lg bg-gray-200 active:bg-gray-400">➕</button>
|
| 47 |
-
</div>
|
| 48 |
-
<div class="flex flex-row justify-center items-center gap-5 text-lg">
|
| 49 |
-
<p class="font-medium p-1 px-3 bg-gray-200">Segmento 3</p>
|
| 50 |
-
<label for="etiquta_3">
|
| 51 |
-
<select name="etiquta_3" class="p-1 rounded bg-gray-200 [*]:capitalize" id="etiquta_3" required>
|
| 52 |
-
<option value="1">no se percibe</option>
|
| 53 |
-
<option value="2">poca percepcion</option>
|
| 54 |
-
<option value="3" selected>se percibe</option>
|
| 55 |
-
<option value="4">percepcion intensa</option>
|
| 56 |
-
<option value="5">percepcion muy intensa</option>
|
| 57 |
-
</select>
|
| 58 |
-
</label>
|
| 59 |
-
<button type="button" class="p-1 rounded-lg bg-gray-200 active:bg-gray-400">➕</button>
|
| 60 |
-
</div>
|
| 61 |
-
<div class="flex flex-row justify-center items-center gap-5 text-lg">
|
| 62 |
-
<p class="font-medium p-1 px-3 bg-gray-200">Segmento 4</p>
|
| 63 |
-
<label for="etiquta_4">
|
| 64 |
-
<select name="etiquta_4" class="p-1 rounded bg-gray-200 [*]:capitalize" id="etiquta_4" required>
|
| 65 |
-
<option value="1">no se percibe</option>
|
| 66 |
-
<option value="2">poca percepcion</option>
|
| 67 |
-
<option value="3">se percibe</option>
|
| 68 |
-
<option value="4" selected>percepcion intensa</option>
|
| 69 |
-
<option value="5">percepcion muy intensa</option>
|
| 70 |
-
</select>
|
| 71 |
-
</label>
|
| 72 |
-
<button type="button" class="p-1 rounded-lg bg-gray-200 active:bg-gray-400">➕</button>
|
| 73 |
-
</div>
|
| 74 |
<div class="flex flex-row justify-center items-center gap-5 text-lg">
|
| 75 |
-
<
|
| 76 |
-
|
| 77 |
-
<select name="etiquta_5" class="p-1 rounded bg-gray-200 [*]:capitalize" id="etiquta_5" required>
|
| 78 |
-
<option value="1">no se percibe</option>
|
| 79 |
-
<option value="2">poca percepcion</option>
|
| 80 |
-
<option value="3">se percibe</option>
|
| 81 |
-
<option value="4">percepcion intensa</option>
|
| 82 |
-
<option value="5" selected>percepcion muy intensa</option>
|
| 83 |
-
</select>
|
| 84 |
</label>
|
|
|
|
| 85 |
<button type="button" class="p-1 rounded-lg bg-gray-200 active:bg-gray-400">➕</button>
|
| 86 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
| 87 |
</article>
|
| 88 |
<article class="absolute bg-gray-800/70 p-5 w-full h-full justify-center items-center hidden">
|
| 89 |
<section class="p-2 bg-gray-400 w-fit">
|
|
@@ -100,4 +61,21 @@
|
|
| 100 |
{% endblock %}
|
| 101 |
|
| 102 |
{% block extra_js %}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 103 |
{% endblock %}
|
|
|
|
| 11 |
- Presentar un orden basico segun el numero de catadores y los productos, esta se le muestra el presentador
|
| 12 |
-->
|
| 13 |
|
| 14 |
+
<!-- <div class="flex flex-row justify-center items-center gap-5 text-lg">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
<p class="font-medium p-1 px-3 bg-gray-200">Segmento 1</p>
|
| 16 |
<label for="etiquta_1">
|
| 17 |
<select name="etiquta_1" class="p-1 rounded bg-gray-200 [*]:capitalize" id="etiquta_1" required>
|
|
|
|
| 23 |
</select>
|
| 24 |
</label>
|
| 25 |
<button type="button" class="p-1 rounded-lg bg-gray-200 active:bg-gray-400">➕</button>
|
| 26 |
+
</div> -->
|
| 27 |
+
|
| 28 |
+
{% block content %}
|
| 29 |
+
<article class="w-full flex flex-col justify-center items-center bg-gray-600 my-10">
|
| 30 |
+
<article class="flex flex-col gap-4 bg-gray-400 md:p-10 p-5 rounded-2xl lg:w-4xl w-full">
|
| 31 |
+
<h1 class="text-center font-bold text-4xl">Panel de configuración</h1>
|
| 32 |
+
<hr>
|
| 33 |
+
<form method="post" action="" class="[&>article]:not-last:mb-4 [&>article]:not-first:pt-4 [&>article]:px-6">
|
| 34 |
+
{% csrf_token %}
|
| 35 |
+
<article class="bg-gray-500 p-4 flex flex-col gap-2">
|
| 36 |
+
{% for field in form_tags %}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 37 |
<div class="flex flex-row justify-center items-center gap-5 text-lg">
|
| 38 |
+
<label for="{{ field.id_for_label }}" class="font-medium p-1 px-3 bg-gray-200 capitalize">
|
| 39 |
+
{{ field.label }}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 40 |
</label>
|
| 41 |
+
{{ field }}
|
| 42 |
<button type="button" class="p-1 rounded-lg bg-gray-200 active:bg-gray-400">➕</button>
|
| 43 |
</div>
|
| 44 |
+
{% endfor %}
|
| 45 |
+
</article>
|
| 46 |
+
<article class="bg-gray-800/70 justify-center items-center">
|
| 47 |
+
<button class="p-2 bg-gray-400 w-fit" type="submit">Mandar</button>
|
| 48 |
</article>
|
| 49 |
<article class="absolute bg-gray-800/70 p-5 w-full h-full justify-center items-center hidden">
|
| 50 |
<section class="p-2 bg-gray-400 w-fit">
|
|
|
|
| 61 |
{% endblock %}
|
| 62 |
|
| 63 |
{% block extra_js %}
|
| 64 |
+
<script>
|
| 65 |
+
const itemsSelects = document.getElementsByClassName("ct-select-op")
|
| 66 |
+
const options = itemsSelects.item(0).getElementsByTagName("option")
|
| 67 |
+
const values = []
|
| 68 |
+
|
| 69 |
+
for (let i = 0; i < options.length; i++) {
|
| 70 |
+
if (options.item(i).value) {
|
| 71 |
+
values.push(options.item(i).value)
|
| 72 |
+
}
|
| 73 |
+
}
|
| 74 |
+
|
| 75 |
+
values.sort()
|
| 76 |
+
|
| 77 |
+
for (let i = 0; i < itemsSelects.length; i++) {
|
| 78 |
+
itemsSelects.item(i).value = values[i]
|
| 79 |
+
}
|
| 80 |
+
</script>
|
| 81 |
{% endblock %}
|
tecnicas/views/configuration_panel_basic.py
CHANGED
|
@@ -1,16 +1,26 @@
|
|
| 1 |
from django.shortcuts import render, redirect
|
| 2 |
from django.http import HttpRequest
|
| 3 |
from django.urls import reverse
|
| 4 |
-
from ..forms import
|
| 5 |
from ..models import TipoTecnica
|
| 6 |
|
| 7 |
def configuracionPanelBasic(req: HttpRequest):
|
| 8 |
if req.method == "POST":
|
| 9 |
-
form =
|
|
|
|
| 10 |
if form.is_valid():
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
elif req.method == "GET":
|
| 15 |
try:
|
| 16 |
id_tecnica = req.GET["id_tecnica"]
|
|
@@ -21,7 +31,7 @@ def configuracionPanelBasic(req: HttpRequest):
|
|
| 21 |
return redirect(reverse("cata_system:seleccion_tecnica") + "?error=tecnica_no_establecida")
|
| 22 |
|
| 23 |
if tecnica:
|
| 24 |
-
form_sesion =
|
| 25 |
return render(req, "tecnicas/configuracion-panel-basic.html", { "form_sesion": form_sesion })
|
| 26 |
else:
|
| 27 |
return redirect(reverse("cata_system:seleccion_tecnica") + "?error=la_tecnica_no_existe")
|
|
|
|
| 1 |
from django.shortcuts import render, redirect
|
| 2 |
from django.http import HttpRequest
|
| 3 |
from django.urls import reverse
|
| 4 |
+
from ..forms import SesionBasicForm
|
| 5 |
from ..models import TipoTecnica
|
| 6 |
|
| 7 |
def configuracionPanelBasic(req: HttpRequest):
|
| 8 |
if req.method == "POST":
|
| 9 |
+
form = SesionBasicForm(req.POST)
|
| 10 |
+
|
| 11 |
if form.is_valid():
|
| 12 |
+
values = {}
|
| 13 |
+
|
| 14 |
+
for name, value in form.cleaned_data.items():
|
| 15 |
+
if not name == "tipo_escala":
|
| 16 |
+
values[name] = value
|
| 17 |
+
else:
|
| 18 |
+
values[name] = value.id
|
| 19 |
+
|
| 20 |
+
req.session['datos_formulario'] = values
|
| 21 |
+
return redirect(reverse("cata_system:panel_configuracion_tags"))
|
| 22 |
+
|
| 23 |
+
return render(req, "tecnicas/configuracion-panel-basic.html", { "form_sesion": form, "error": "Ha ocurrido un error al continuar al siguiente paso." })
|
| 24 |
elif req.method == "GET":
|
| 25 |
try:
|
| 26 |
id_tecnica = req.GET["id_tecnica"]
|
|
|
|
| 31 |
return redirect(reverse("cata_system:seleccion_tecnica") + "?error=tecnica_no_establecida")
|
| 32 |
|
| 33 |
if tecnica:
|
| 34 |
+
form_sesion = SesionBasicForm(id_tecnica_new=id_tecnica)
|
| 35 |
return render(req, "tecnicas/configuracion-panel-basic.html", { "form_sesion": form_sesion })
|
| 36 |
else:
|
| 37 |
return redirect(reverse("cata_system:seleccion_tecnica") + "?error=la_tecnica_no_existe")
|
tecnicas/views/configuration_panel_tags.py
CHANGED
|
@@ -1,5 +1,13 @@
|
|
| 1 |
from django.http import HttpRequest
|
| 2 |
-
from django.shortcuts import render
|
|
|
|
|
|
|
| 3 |
|
| 4 |
def configuracionPanelTags(req: HttpRequest):
|
| 5 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
from django.http import HttpRequest
|
| 2 |
+
from django.shortcuts import redirect, render
|
| 3 |
+
from django.urls import reverse
|
| 4 |
+
from ..forms import SesionTagsForm
|
| 5 |
|
| 6 |
def configuracionPanelTags(req: HttpRequest):
|
| 7 |
+
# basic_data = req.session.get("basic_form", None)
|
| 8 |
+
|
| 9 |
+
# if basic_data is None:
|
| 10 |
+
# return redirect(reverse('cata_system:panel_configuracion_basic'))
|
| 11 |
+
|
| 12 |
+
etiquetas = SesionTagsForm(segmentos=5)
|
| 13 |
+
return render(req, "tecnicas/configuracion-panel-tags.html", {"form_tags":etiquetas})
|