Spaces:
Sleeping
Sleeping
Cambiando nombres y funciones de views en ingles
Browse files- tecnicas/templates/tecnicas/create_sesion/configuracion-panel-codes.html +1 -1
- tecnicas/urls.py +2 -2
- tecnicas/views/__init__.py +5 -5
- tecnicas/views/api_tag.py +4 -4
- tecnicas/views/configuration_panel_basic.py +1 -1
- tecnicas/views/configuration_panel_codes.py +4 -4
- tecnicas/views/configuration_panel_tags.py +4 -4
- tecnicas/views/{configurations_panel_words.py → configuration_panel_words.py} +1 -1
- tecnicas/views/{panel_sessions.py → sessions_panel.py} +1 -1
- tecnicas/views/{catador_create.py → tester_create.py} +9 -8
- tecnicas/views/{catador_search.py → tester_search.py} +7 -7
tecnicas/templates/tecnicas/create_sesion/configuracion-panel-codes.html
CHANGED
|
@@ -45,7 +45,7 @@
|
|
| 45 |
class="ct-btn-submit uppercase text-lg tracking-wider font-medium p-2 px-4 border-b-2 active:border-b-0 active:border-t-2 active:border-yellow-500 border-yellow-800 transition-all rounded-xl bg-yellow-500 text-white w-fit disabled:bg-amber-600">Continuar</button>
|
| 46 |
</article>
|
| 47 |
</form>
|
| 48 |
-
<input type="number" value="{{
|
| 49 |
</article>
|
| 50 |
</article>
|
| 51 |
{% endblock %}
|
|
|
|
| 45 |
class="ct-btn-submit uppercase text-lg tracking-wider font-medium p-2 px-4 border-b-2 active:border-b-0 active:border-t-2 active:border-yellow-500 border-yellow-800 transition-all rounded-xl bg-yellow-500 text-white w-fit disabled:bg-amber-600">Continuar</button>
|
| 46 |
</article>
|
| 47 |
</form>
|
| 48 |
+
<input type="number" value="{{ num_tester }}" class="ct-num-cata hidden" disabled>
|
| 49 |
</article>
|
| 50 |
</article>
|
| 51 |
{% endblock %}
|
tecnicas/urls.py
CHANGED
|
@@ -15,7 +15,7 @@ urlpatterns = [
|
|
| 15 |
path("panel-configuracion-tags", views.configuracionPanelTags, name="panel_configuracion_tags"),
|
| 16 |
path("panel-configuracion-codes", views.configurationsPanelCodes, name="panel_configuracion_codes"),
|
| 17 |
path("nueva-etiqueta", views.newTag, name="nueva_etiqueta"),
|
| 18 |
-
path("crear-catador", views.
|
| 19 |
-
path("buscar-catador", views.
|
| 20 |
path("api/palabras", views.words, name="api_palabras"),
|
| 21 |
]
|
|
|
|
| 15 |
path("panel-configuracion-tags", views.configuracionPanelTags, name="panel_configuracion_tags"),
|
| 16 |
path("panel-configuracion-codes", views.configurationsPanelCodes, name="panel_configuracion_codes"),
|
| 17 |
path("nueva-etiqueta", views.newTag, name="nueva_etiqueta"),
|
| 18 |
+
path("crear-catador", views.testerCreate, name="crear_catador"),
|
| 19 |
+
path("buscar-catador", views.testerSearch, name="buscar_catador"),
|
| 20 |
path("api/palabras", views.words, name="api_palabras"),
|
| 21 |
]
|
tecnicas/views/__init__.py
CHANGED
|
@@ -2,12 +2,12 @@ from .autentication import autentication
|
|
| 2 |
from .login_catador import catadorLogin
|
| 3 |
from .main_panel import mainPanel
|
| 4 |
from .management_catadores import managementCatadores
|
| 5 |
-
from .
|
| 6 |
from .seleccion_tecnica import selecionTecnica
|
| 7 |
-
from .configuration_panel_basic import
|
| 8 |
from .configuration_panel_tags import configuracionPanelTags
|
| 9 |
-
from .configuration_panel_codes import
|
| 10 |
from .api_tag import newTag
|
| 11 |
-
from .
|
| 12 |
-
from .
|
| 13 |
from .api_words import words
|
|
|
|
| 2 |
from .login_catador import catadorLogin
|
| 3 |
from .main_panel import mainPanel
|
| 4 |
from .management_catadores import managementCatadores
|
| 5 |
+
from .sessions_panel import sesionsPanel
|
| 6 |
from .seleccion_tecnica import selecionTecnica
|
| 7 |
+
from .configuration_panel_basic import configurationPanelBasic
|
| 8 |
from .configuration_panel_tags import configuracionPanelTags
|
| 9 |
+
from .configuration_panel_codes import configurationPanelCodes
|
| 10 |
from .api_tag import newTag
|
| 11 |
+
from .tester_create import testerCreate
|
| 12 |
+
from .tester_search import testerSearch
|
| 13 |
from .api_words import words
|
tecnicas/views/api_tag.py
CHANGED
|
@@ -12,9 +12,9 @@ def newTag(req: HttpRequest):
|
|
| 12 |
try:
|
| 13 |
form = EtiquetaForm(req.POST)
|
| 14 |
if form.is_valid():
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
else:
|
| 19 |
return general_error()
|
| 20 |
except KeyError:
|
|
@@ -22,7 +22,7 @@ def newTag(req: HttpRequest):
|
|
| 22 |
|
| 23 |
try:
|
| 24 |
new_etiqueta = Etiqueta.objects.create(
|
| 25 |
-
valor_etiqueta=
|
| 26 |
except IntegrityError:
|
| 27 |
return general_error("etiqueta repetida")
|
| 28 |
|
|
|
|
| 12 |
try:
|
| 13 |
form = EtiquetaForm(req.POST)
|
| 14 |
if form.is_valid():
|
| 15 |
+
value_tag = form.cleaned_data["nueva_etiqueta"]
|
| 16 |
+
value_tag = value_tag.strip()
|
| 17 |
+
value_tag = value_tag.lower()
|
| 18 |
else:
|
| 19 |
return general_error()
|
| 20 |
except KeyError:
|
|
|
|
| 22 |
|
| 23 |
try:
|
| 24 |
new_etiqueta = Etiqueta.objects.create(
|
| 25 |
+
valor_etiqueta=value_tag)
|
| 26 |
except IntegrityError:
|
| 27 |
return general_error("etiqueta repetida")
|
| 28 |
|
tecnicas/views/configuration_panel_basic.py
CHANGED
|
@@ -4,7 +4,7 @@ from django.urls import reverse
|
|
| 4 |
from ..forms import SesionBasicForm
|
| 5 |
from ..models import TipoTecnica
|
| 6 |
|
| 7 |
-
def
|
| 8 |
if req.method == "POST":
|
| 9 |
try:
|
| 10 |
form = SesionBasicForm(req.POST)
|
|
|
|
| 4 |
from ..forms import SesionBasicForm
|
| 5 |
from ..models import TipoTecnica
|
| 6 |
|
| 7 |
+
def configurationPanelBasic(req: HttpRequest):
|
| 8 |
if req.method == "POST":
|
| 9 |
try:
|
| 10 |
form = SesionBasicForm(req.POST)
|
tecnicas/views/configuration_panel_codes.py
CHANGED
|
@@ -6,7 +6,7 @@ from ..forms import PalabrasForm
|
|
| 6 |
import json
|
| 7 |
|
| 8 |
|
| 9 |
-
def
|
| 10 |
data_basic = req.session["form_basic"]
|
| 11 |
data_tags = req.session["form_tags"]
|
| 12 |
|
|
@@ -15,7 +15,7 @@ def configurationsPanelCodes(req: HttpRequest):
|
|
| 15 |
"?error=datos del formulario requerido no encontrados")
|
| 16 |
|
| 17 |
num_products = data_basic["numero_productos"]
|
| 18 |
-
|
| 19 |
|
| 20 |
if req.method == "GET":
|
| 21 |
codes_products = generarCodigos(num_products)
|
|
@@ -24,7 +24,7 @@ def configurationsPanelCodes(req: HttpRequest):
|
|
| 24 |
|
| 25 |
context_worlds_form = {
|
| 26 |
"form_worlds": form_worlds,
|
| 27 |
-
"
|
| 28 |
}
|
| 29 |
|
| 30 |
return render(req, "tecnicas/create_sesion/configuracion-panel-codes.html", context_worlds_form)
|
|
@@ -41,7 +41,7 @@ def configurationsPanelCodes(req: HttpRequest):
|
|
| 41 |
|
| 42 |
context_worlds_form = {
|
| 43 |
"form_worlds": form_worlds,
|
| 44 |
-
"
|
| 45 |
}
|
| 46 |
|
| 47 |
if form_worlds.is_valid():
|
|
|
|
| 6 |
import json
|
| 7 |
|
| 8 |
|
| 9 |
+
def configurationPanelCodes(req: HttpRequest):
|
| 10 |
data_basic = req.session["form_basic"]
|
| 11 |
data_tags = req.session["form_tags"]
|
| 12 |
|
|
|
|
| 15 |
"?error=datos del formulario requerido no encontrados")
|
| 16 |
|
| 17 |
num_products = data_basic["numero_productos"]
|
| 18 |
+
num_tester = data_basic["numero_catadores"]
|
| 19 |
|
| 20 |
if req.method == "GET":
|
| 21 |
codes_products = generarCodigos(num_products)
|
|
|
|
| 24 |
|
| 25 |
context_worlds_form = {
|
| 26 |
"form_worlds": form_worlds,
|
| 27 |
+
"num_tester": num_tester
|
| 28 |
}
|
| 29 |
|
| 30 |
return render(req, "tecnicas/create_sesion/configuracion-panel-codes.html", context_worlds_form)
|
|
|
|
| 41 |
|
| 42 |
context_worlds_form = {
|
| 43 |
"form_worlds": form_worlds,
|
| 44 |
+
"num_tester": num_tester,
|
| 45 |
}
|
| 46 |
|
| 47 |
if form_worlds.is_valid():
|
tecnicas/views/configuration_panel_tags.py
CHANGED
|
@@ -4,18 +4,18 @@ from django.urls import reverse
|
|
| 4 |
from ..forms import SesionTagsForm, EtiquetaForm
|
| 5 |
from ..models import TipoEscala
|
| 6 |
|
| 7 |
-
def
|
| 8 |
basic_data = req.session.get("form_basic", {})
|
| 9 |
|
| 10 |
if not basic_data:
|
| 11 |
return redirect(reverse('cata_system:panel_configuracion_basic'))
|
| 12 |
|
| 13 |
-
|
| 14 |
tamano_escala = basic_data["tamano_escala"]
|
| 15 |
form_new_etiqueta = EtiquetaForm()
|
| 16 |
|
| 17 |
if req.method == "GET":
|
| 18 |
-
form_etiqutas = SesionTagsForm(longitud=tamano_escala, tipo_escala=
|
| 19 |
|
| 20 |
context_tags = {
|
| 21 |
"form_tags":form_etiqutas,
|
|
@@ -25,7 +25,7 @@ def configuracionPanelTags(req: HttpRequest):
|
|
| 25 |
return render(req, "tecnicas/create_sesion/configuracion-panel-tags.html", context_tags)
|
| 26 |
elif req.method == "POST":
|
| 27 |
values = {}
|
| 28 |
-
form = SesionTagsForm(req.POST, longitud=tamano_escala, tipo_escala=
|
| 29 |
|
| 30 |
context_tags = {
|
| 31 |
"form_tags":form,
|
|
|
|
| 4 |
from ..forms import SesionTagsForm, EtiquetaForm
|
| 5 |
from ..models import TipoEscala
|
| 6 |
|
| 7 |
+
def configurationPanelTags(req: HttpRequest):
|
| 8 |
basic_data = req.session.get("form_basic", {})
|
| 9 |
|
| 10 |
if not basic_data:
|
| 11 |
return redirect(reverse('cata_system:panel_configuracion_basic'))
|
| 12 |
|
| 13 |
+
type_scale = TipoEscala.objects.get(pk=basic_data["tipo_escala"])
|
| 14 |
tamano_escala = basic_data["tamano_escala"]
|
| 15 |
form_new_etiqueta = EtiquetaForm()
|
| 16 |
|
| 17 |
if req.method == "GET":
|
| 18 |
+
form_etiqutas = SesionTagsForm(longitud=tamano_escala, tipo_escala=type_scale.nombre_escala)
|
| 19 |
|
| 20 |
context_tags = {
|
| 21 |
"form_tags":form_etiqutas,
|
|
|
|
| 25 |
return render(req, "tecnicas/create_sesion/configuracion-panel-tags.html", context_tags)
|
| 26 |
elif req.method == "POST":
|
| 27 |
values = {}
|
| 28 |
+
form = SesionTagsForm(req.POST, longitud=tamano_escala, tipo_escala=type_scale.nombre_escala)
|
| 29 |
|
| 30 |
context_tags = {
|
| 31 |
"form_tags":form,
|
tecnicas/views/{configurations_panel_words.py → configuration_panel_words.py}
RENAMED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
from django.http import HttpRequest
|
| 2 |
from ..utils import general_error
|
| 3 |
|
| 4 |
-
def
|
| 5 |
if req.method == "GET":
|
| 6 |
return general_error("This endpoint is not implemented yet.")
|
| 7 |
else:
|
|
|
|
| 1 |
from django.http import HttpRequest
|
| 2 |
from ..utils import general_error
|
| 3 |
|
| 4 |
+
def configurationPanelWords(req: HttpRequest):
|
| 5 |
if req.method == "GET":
|
| 6 |
return general_error("This endpoint is not implemented yet.")
|
| 7 |
else:
|
tecnicas/views/{panel_sessions.py → sessions_panel.py}
RENAMED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
from django.shortcuts import render
|
| 2 |
|
| 3 |
|
| 4 |
-
def
|
| 5 |
elementos = []
|
| 6 |
|
| 7 |
for i in range(6):
|
|
|
|
| 1 |
from django.shortcuts import render
|
| 2 |
|
| 3 |
|
| 4 |
+
def sesionsPanel(req):
|
| 5 |
elementos = []
|
| 6 |
|
| 7 |
for i in range(6):
|
tecnicas/views/{catador_create.py → tester_create.py}
RENAMED
|
@@ -3,24 +3,25 @@ from django.forms import ValidationError
|
|
| 3 |
from django.shortcuts import render
|
| 4 |
from ..forms import CatadorForm
|
| 5 |
|
| 6 |
-
|
|
|
|
| 7 |
if req.method == "GET":
|
| 8 |
-
formCatador =
|
| 9 |
|
| 10 |
context = {
|
| 11 |
"form_cata": formCatador
|
| 12 |
}
|
| 13 |
-
|
| 14 |
return render(req, "tecnicas/manage_tester/catador-crear.html", context)
|
| 15 |
elif req.method == "POST":
|
| 16 |
-
|
| 17 |
context = {
|
| 18 |
-
"form_cata":
|
| 19 |
}
|
| 20 |
|
| 21 |
-
if
|
| 22 |
try:
|
| 23 |
-
|
| 24 |
context["message"] = "datos guardados"
|
| 25 |
context["form_cata"] = CatadorForm()
|
| 26 |
except ValidationError:
|
|
@@ -30,4 +31,4 @@ def crearCatador(req : HttpRequest):
|
|
| 30 |
return render(req, "tecnicas/manage_tester/catador-crear.html", context)
|
| 31 |
else:
|
| 32 |
context["error"] = "datos no validos"
|
| 33 |
-
return render(req, "tecnicas/manage_tester/catador-crear.html", context)
|
|
|
|
| 3 |
from django.shortcuts import render
|
| 4 |
from ..forms import CatadorForm
|
| 5 |
|
| 6 |
+
|
| 7 |
+
def testerCreate(req: HttpRequest):
|
| 8 |
if req.method == "GET":
|
| 9 |
+
formCatador = CatadorForm()
|
| 10 |
|
| 11 |
context = {
|
| 12 |
"form_cata": formCatador
|
| 13 |
}
|
| 14 |
+
|
| 15 |
return render(req, "tecnicas/manage_tester/catador-crear.html", context)
|
| 16 |
elif req.method == "POST":
|
| 17 |
+
formTesterValues = CatadorForm(req.POST)
|
| 18 |
context = {
|
| 19 |
+
"form_cata": formTesterValues
|
| 20 |
}
|
| 21 |
|
| 22 |
+
if formTesterValues.is_valid():
|
| 23 |
try:
|
| 24 |
+
formTesterValues.save()
|
| 25 |
context["message"] = "datos guardados"
|
| 26 |
context["form_cata"] = CatadorForm()
|
| 27 |
except ValidationError:
|
|
|
|
| 31 |
return render(req, "tecnicas/manage_tester/catador-crear.html", context)
|
| 32 |
else:
|
| 33 |
context["error"] = "datos no validos"
|
| 34 |
+
return render(req, "tecnicas/manage_tester/catador-crear.html", context)
|
tecnicas/views/{catador_search.py → tester_search.py}
RENAMED
|
@@ -5,7 +5,7 @@ from django.core.exceptions import ObjectDoesNotExist
|
|
| 5 |
from ..forms import CatadorForm
|
| 6 |
from ..models import Catador
|
| 7 |
|
| 8 |
-
def
|
| 9 |
if req.method == "GET":
|
| 10 |
context = {}
|
| 11 |
|
|
@@ -18,8 +18,8 @@ def searchCatador(req : HttpRequest):
|
|
| 18 |
return render(req, "tecnicas/manage_tester/catador-buscar.html")
|
| 19 |
|
| 20 |
try:
|
| 21 |
-
|
| 22 |
-
context["form_catador"] = CatadorForm(instance=
|
| 23 |
except Catador.DoesNotExist:
|
| 24 |
context["error"] = "usuario no encontrado"
|
| 25 |
|
|
@@ -28,19 +28,19 @@ def searchCatador(req : HttpRequest):
|
|
| 28 |
context = {}
|
| 29 |
|
| 30 |
try:
|
| 31 |
-
|
| 32 |
except:
|
| 33 |
-
|
| 34 |
|
| 35 |
nameUser = req.POST["usuarioCatador"]
|
| 36 |
|
| 37 |
-
if not
|
| 38 |
context["error"] = "ha ocurrido un error en recueperar los datos"
|
| 39 |
return render(req, "tecnicas/manage_tester/catador-buscar.html", context)
|
| 40 |
|
| 41 |
user = get_object_or_404(Catador, usuarioCatador=nameUser)
|
| 42 |
|
| 43 |
-
modelForm = CatadorForm(
|
| 44 |
|
| 45 |
try:
|
| 46 |
if not modelForm.is_valid():
|
|
|
|
| 5 |
from ..forms import CatadorForm
|
| 6 |
from ..models import Catador
|
| 7 |
|
| 8 |
+
def testerSearch(req : HttpRequest):
|
| 9 |
if req.method == "GET":
|
| 10 |
context = {}
|
| 11 |
|
|
|
|
| 18 |
return render(req, "tecnicas/manage_tester/catador-buscar.html")
|
| 19 |
|
| 20 |
try:
|
| 21 |
+
tester = Catador.objects.get(usuarioCatador=user)
|
| 22 |
+
context["form_catador"] = CatadorForm(instance=tester)
|
| 23 |
except Catador.DoesNotExist:
|
| 24 |
context["error"] = "usuario no encontrado"
|
| 25 |
|
|
|
|
| 28 |
context = {}
|
| 29 |
|
| 30 |
try:
|
| 31 |
+
infoTester = req.POST
|
| 32 |
except:
|
| 33 |
+
infoTester = False
|
| 34 |
|
| 35 |
nameUser = req.POST["usuarioCatador"]
|
| 36 |
|
| 37 |
+
if not infoTester:
|
| 38 |
context["error"] = "ha ocurrido un error en recueperar los datos"
|
| 39 |
return render(req, "tecnicas/manage_tester/catador-buscar.html", context)
|
| 40 |
|
| 41 |
user = get_object_or_404(Catador, usuarioCatador=nameUser)
|
| 42 |
|
| 43 |
+
modelForm = CatadorForm(infoTester, instance=user)
|
| 44 |
|
| 45 |
try:
|
| 46 |
if not modelForm.is_valid():
|