Spaces:
Sleeping
Sleeping
Listado de Vocabularios
Browse files- tecnicas/controllers/__init__.py +2 -1
- tecnicas/controllers/views_controller/{list_sessions_tester_controller.py → sessions_tester/list_sessions_tester_controller.py} +0 -0
- tecnicas/controllers/views_controller/vocabulary_manage/create_vocabulary_controller.py +3 -3
- tecnicas/controllers/views_controller/vocabulary_manage/list_vocabulary_controller.py +48 -0
- tecnicas/migrations/0021_rename_nomre_vocabulario_vocabulario_nombre_vocabulario_and_more.py +30 -0
- tecnicas/models/vocabulario.py +7 -4
- tecnicas/templates/tecnicas/components/item_vocabulary.html +20 -0
- tecnicas/templates/tecnicas/manage_vocabulary/list-vocabulary.html +57 -0
- tecnicas/templates/tecnicas/manage_vocabulary/panel-vocabulary.html +1 -1
- tecnicas/urls.py +4 -0
- tecnicas/views/__init__.py +1 -0
- tecnicas/views/vocabulary_management/list_vocabulary.py +11 -0
tecnicas/controllers/__init__.py
CHANGED
|
@@ -28,9 +28,10 @@ from .views_controller.session_management.monitor_rata_controller import Monitor
|
|
| 28 |
from .views_controller.sessions_tester.login_session_tester_controller import LoginSessionTesterController
|
| 29 |
from .views_controller.sessions_tester.init_session_tester_controller import InitSessionTesterController
|
| 30 |
from .views_controller.sessions_tester.convencional_scales_controller import ConvencionalScalesController
|
|
|
|
| 31 |
|
| 32 |
from .views_controller.vocabulary_manage.create_vocabulary_controller import CreateVocabularyController
|
|
|
|
| 33 |
|
| 34 |
from .views_controller.api_rating_controller import ApiRatingController
|
| 35 |
from .views_controller.tester_list_controller import TesterListController
|
| 36 |
-
from .views_controller.list_sessions_tester_controller import ListSessionsTesterController
|
|
|
|
| 28 |
from .views_controller.sessions_tester.login_session_tester_controller import LoginSessionTesterController
|
| 29 |
from .views_controller.sessions_tester.init_session_tester_controller import InitSessionTesterController
|
| 30 |
from .views_controller.sessions_tester.convencional_scales_controller import ConvencionalScalesController
|
| 31 |
+
from .views_controller.sessions_tester.list_sessions_tester_controller import ListSessionsTesterController
|
| 32 |
|
| 33 |
from .views_controller.vocabulary_manage.create_vocabulary_controller import CreateVocabularyController
|
| 34 |
+
from .views_controller.vocabulary_manage.list_vocabulary_controller import ListVocabularyController
|
| 35 |
|
| 36 |
from .views_controller.api_rating_controller import ApiRatingController
|
| 37 |
from .views_controller.tester_list_controller import TesterListController
|
|
|
tecnicas/controllers/views_controller/{list_sessions_tester_controller.py → sessions_tester/list_sessions_tester_controller.py}
RENAMED
|
File without changes
|
tecnicas/controllers/views_controller/vocabulary_manage/create_vocabulary_controller.py
CHANGED
|
@@ -20,11 +20,11 @@ class CreateVocabularyController():
|
|
| 20 |
"words": self.context["words"],
|
| 21 |
}
|
| 22 |
|
| 23 |
-
if "
|
| 24 |
-
current = Vocabulario.objects.get(
|
| 25 |
|
| 26 |
self.context = {
|
| 27 |
-
"name_vacabulary": current.
|
| 28 |
"words": current.palabras.all()
|
| 29 |
}
|
| 30 |
|
|
|
|
| 20 |
"words": self.context["words"],
|
| 21 |
}
|
| 22 |
|
| 23 |
+
if "name_voca" in request.GET:
|
| 24 |
+
current = Vocabulario.objects.get(nombre_vocabulario=request.GET["name_voca"])
|
| 25 |
|
| 26 |
self.context = {
|
| 27 |
+
"name_vacabulary": current.nombre_vocabulario,
|
| 28 |
"words": current.palabras.all()
|
| 29 |
}
|
| 30 |
|
tecnicas/controllers/views_controller/vocabulary_manage/list_vocabulary_controller.py
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from django.shortcuts import render
|
| 2 |
+
from django.http import HttpRequest
|
| 3 |
+
from django.core.paginator import Paginator, PageNotAnInteger
|
| 4 |
+
from tecnicas.models import Vocabulario
|
| 5 |
+
from tecnicas.utils import controller_error
|
| 6 |
+
|
| 7 |
+
|
| 8 |
+
class ListVocabularyController():
|
| 9 |
+
current_url = "tecnicas/manage_vocabulary/list-vocabulary.html"
|
| 10 |
+
|
| 11 |
+
def __init__(self):
|
| 12 |
+
pass
|
| 13 |
+
|
| 14 |
+
def controllGet(self, request: HttpRequest, page: int):
|
| 15 |
+
context = {}
|
| 16 |
+
|
| 17 |
+
info_element_page = self.getVocabularys(page)
|
| 18 |
+
|
| 19 |
+
if isinstance(info_element_page, dict):
|
| 20 |
+
context["error"] = info_element_page["error"]
|
| 21 |
+
return render(request, self.current_url, context)
|
| 22 |
+
|
| 23 |
+
(vocabularies_in_page, is_last_page, current_page) = info_element_page
|
| 24 |
+
|
| 25 |
+
context["vocabularies"] = vocabularies_in_page
|
| 26 |
+
context["last_page"] = is_last_page
|
| 27 |
+
context["num_page"] = current_page
|
| 28 |
+
|
| 29 |
+
return render(request, self.current_url, context)
|
| 30 |
+
|
| 31 |
+
def getVocabularys(self, num_page: int):
|
| 32 |
+
elements_by_page = 6
|
| 33 |
+
|
| 34 |
+
queryset = Vocabulario.objects.all().order_by('-creado')
|
| 35 |
+
|
| 36 |
+
paginator = Paginator(queryset, elements_by_page)
|
| 37 |
+
try:
|
| 38 |
+
vocabularies_in_page = paginator.page(num_page)
|
| 39 |
+
except PageNotAnInteger:
|
| 40 |
+
return controller_error("índice inválido")
|
| 41 |
+
|
| 42 |
+
if not vocabularies_in_page.object_list:
|
| 43 |
+
return controller_error("Sin registros de Participaciones")
|
| 44 |
+
|
| 45 |
+
current_page = vocabularies_in_page.number
|
| 46 |
+
is_last_page = not current_page < paginator.num_pages
|
| 47 |
+
|
| 48 |
+
return (vocabularies_in_page, is_last_page, current_page)
|
tecnicas/migrations/0021_rename_nomre_vocabulario_vocabulario_nombre_vocabulario_and_more.py
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Generated by Django 5.2.1 on 2025-11-06 21:46
|
| 2 |
+
|
| 3 |
+
import django.utils.timezone
|
| 4 |
+
import shortuuid.main
|
| 5 |
+
from django.db import migrations, models
|
| 6 |
+
|
| 7 |
+
|
| 8 |
+
class Migration(migrations.Migration):
|
| 9 |
+
|
| 10 |
+
dependencies = [
|
| 11 |
+
('tecnicas', '0020_remove_catador_apellido_remove_catador_correo_and_more'),
|
| 12 |
+
]
|
| 13 |
+
|
| 14 |
+
operations = [
|
| 15 |
+
migrations.RenameField(
|
| 16 |
+
model_name='vocabulario',
|
| 17 |
+
old_name='nomre_vocabulario',
|
| 18 |
+
new_name='nombre_vocabulario',
|
| 19 |
+
),
|
| 20 |
+
migrations.AddField(
|
| 21 |
+
model_name='vocabulario',
|
| 22 |
+
name='creado',
|
| 23 |
+
field=models.DateTimeField(default=django.utils.timezone.now),
|
| 24 |
+
),
|
| 25 |
+
migrations.AlterField(
|
| 26 |
+
model_name='sesionsensorial',
|
| 27 |
+
name='codigo_sesion',
|
| 28 |
+
field=models.CharField(default=shortuuid.main.ShortUUID.uuid, editable=False, max_length=22, primary_key=True, serialize=False),
|
| 29 |
+
),
|
| 30 |
+
]
|
tecnicas/models/vocabulario.py
CHANGED
|
@@ -1,10 +1,13 @@
|
|
| 1 |
from django.db import models
|
| 2 |
-
|
| 3 |
from .palabra import Palabra
|
| 4 |
|
|
|
|
| 5 |
class Vocabulario(models.Model):
|
| 6 |
-
|
| 7 |
-
palabras = models.ManyToManyField(
|
|
|
|
|
|
|
| 8 |
|
| 9 |
def __str__(self):
|
| 10 |
-
return self.
|
|
|
|
| 1 |
from django.db import models
|
| 2 |
+
from django.utils import timezone
|
| 3 |
from .palabra import Palabra
|
| 4 |
|
| 5 |
+
|
| 6 |
class Vocabulario(models.Model):
|
| 7 |
+
nombre_vocabulario = models.CharField(max_length=255, unique=True)
|
| 8 |
+
palabras = models.ManyToManyField(
|
| 9 |
+
Palabra, related_name="vovabulario_palabras")
|
| 10 |
+
creado = models.DateTimeField(default=timezone.now)
|
| 11 |
|
| 12 |
def __str__(self):
|
| 13 |
+
return self.nombre_vocabulario
|
tecnicas/templates/tecnicas/components/item_vocabulary.html
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<div class='card bg-surface-ligt shadow-lg text-black sm:max-w-80 w-full flex justify-center items-center'>
|
| 2 |
+
<div class="card-body flex flex-col justify-between w-full">
|
| 3 |
+
<div class="flex flex-col gap-2">
|
| 4 |
+
<h2 class="text-xl font-bold text-right bg-btn-secondary text-white p-2 rounded">
|
| 5 |
+
{{ vocabulary.nombre_vocabulario }}
|
| 6 |
+
</h2>
|
| 7 |
+
<div class="text-lg bg-surface-alter-card p-2 rounded">
|
| 8 |
+
<p class="font-bold">Creado en:</p>
|
| 9 |
+
<p>{{ vocabulary.creado }}</p>
|
| 10 |
+
</div>
|
| 11 |
+
</div>
|
| 12 |
+
<div>
|
| 13 |
+
<a href="{% url 'cata_system:crear_vocabulario' %}?name_voca={{vocabulary.nombre_vocabulario}}">
|
| 14 |
+
<button class="btn bg-btn-primary border-0 block w-full btn-push">
|
| 15 |
+
Revisar Vocabulario
|
| 16 |
+
</button>
|
| 17 |
+
</a>
|
| 18 |
+
</div>
|
| 19 |
+
</div>
|
| 20 |
+
</div>
|
tecnicas/templates/tecnicas/manage_vocabulary/list-vocabulary.html
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{% extends 'tecnicas/layouts/base.html' %}
|
| 2 |
+
{% load static %}
|
| 3 |
+
|
| 4 |
+
{% block title %}Panel Sesiones{% endblock %}
|
| 5 |
+
|
| 6 |
+
{% block content %}
|
| 7 |
+
<article class="cts-container-main">
|
| 8 |
+
<article class="cts-wrap-content">
|
| 9 |
+
<header class="text-center flex flex-row max-sm:flex-col gap-8 items-center w-full">
|
| 10 |
+
<div class="bg-surface-card p-4 text-black shadow-lg rounded-xl flex-1">
|
| 11 |
+
<h1 class="font-bold text-2xl">Revisa los vocabularios existentes</h1>
|
| 12 |
+
</div>
|
| 13 |
+
<div class="flex-1 flex justify-end items-center">
|
| 14 |
+
<a href="{% url 'cata_system:panel_vocabulario' %}" class="w-fit">
|
| 15 |
+
<button class="cts-btn-general cts-btn-error btn-push">
|
| 16 |
+
Panel Vocabulario
|
| 17 |
+
</button>
|
| 18 |
+
</a>
|
| 19 |
+
</div>
|
| 20 |
+
</header>
|
| 21 |
+
{% if message %}
|
| 22 |
+
{% include "../components/error-message.html" with message=message %}
|
| 23 |
+
{% endif %}
|
| 24 |
+
|
| 25 |
+
{% if error %}
|
| 26 |
+
{% include "../components/error-message.html" with message=error %}
|
| 27 |
+
|
| 28 |
+
{% else %}
|
| 29 |
+
<section class="grid grid-cols-3 max-lg:grid-cols-2 max-sm:grid-cols-1 w-full gap-4 justify-center">
|
| 30 |
+
{% for vocabu in vocabularies %}
|
| 31 |
+
{% include "../components/item_vocabulary.html" with vocabulary=vocabu %}
|
| 32 |
+
{% endfor %}
|
| 33 |
+
</section>
|
| 34 |
+
|
| 35 |
+
<section class="flex justify-center items-center gap-2">
|
| 36 |
+
<div class="join space-x-2">
|
| 37 |
+
{% if num_page != 1 %}
|
| 38 |
+
<a href="{% url 'cata_system:panel_sesiones' page=num_page|add:-1 %}" class="w-fit">
|
| 39 |
+
<button class="join-item btn bg-btn-secondary py-1">
|
| 40 |
+
<img class="h-full" src="{% static 'img/less-than.svg' %}" alt="menor que">
|
| 41 |
+
</button>
|
| 42 |
+
</a>
|
| 43 |
+
{% endif %}
|
| 44 |
+
<button class="join-item btn bg-btn-secondary">Page {{ num_page }}</button>
|
| 45 |
+
{% if not last_page %}
|
| 46 |
+
<a href="{% url 'cata_system:panel_sesiones' page=num_page|add:1 %}" class="w-fit">
|
| 47 |
+
<button class="join-item btn bg-btn-secondary py-1">
|
| 48 |
+
<img class="h-full" src="{% static 'img/greater-than.svg' %}" alt="mayor que">
|
| 49 |
+
</button>
|
| 50 |
+
</a>
|
| 51 |
+
{% endif %}
|
| 52 |
+
</div>
|
| 53 |
+
</section>
|
| 54 |
+
{% endif %}
|
| 55 |
+
</article>
|
| 56 |
+
</article>
|
| 57 |
+
{% endblock %}
|
tecnicas/templates/tecnicas/manage_vocabulary/panel-vocabulary.html
CHANGED
|
@@ -27,7 +27,7 @@
|
|
| 27 |
➕ Crear Vocabulario
|
| 28 |
</button>
|
| 29 |
</a>
|
| 30 |
-
<a href="
|
| 31 |
<button class="w-full h-full cts-btn-general cts-btn-tertiary btn-push">
|
| 32 |
📋 Ver vocabularios
|
| 33 |
</button>
|
|
|
|
| 27 |
➕ Crear Vocabulario
|
| 28 |
</button>
|
| 29 |
</a>
|
| 30 |
+
<a href="{% url 'cata_system:lista_vocabulario' num_page=1 %}" class="flex-1">
|
| 31 |
<button class="w-full h-full cts-btn-general cts-btn-tertiary btn-push">
|
| 32 |
📋 Ver vocabularios
|
| 33 |
</button>
|
tecnicas/urls.py
CHANGED
|
@@ -53,6 +53,10 @@ urlpatterns = [
|
|
| 53 |
views.createVocabulary,
|
| 54 |
name="crear_vocabulario"),
|
| 55 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 56 |
# Gestion de catadores
|
| 57 |
path("presenter/panel-catadores",
|
| 58 |
views.testerMenu,
|
|
|
|
| 53 |
views.createVocabulary,
|
| 54 |
name="crear_vocabulario"),
|
| 55 |
|
| 56 |
+
path("presenter/lista-vocabulario/<int:num_page>",
|
| 57 |
+
views.listVocabulary,
|
| 58 |
+
name="lista_vocabulario"),
|
| 59 |
+
|
| 60 |
# Gestion de catadores
|
| 61 |
path("presenter/panel-catadores",
|
| 62 |
views.testerMenu,
|
tecnicas/views/__init__.py
CHANGED
|
@@ -20,6 +20,7 @@ from .tester_management.tester_list import testerList
|
|
| 20 |
|
| 21 |
from .vocabulary_management.vocabulry_menu import vocabularyMenu
|
| 22 |
from .vocabulary_management.create_vocabulary import createVocabulary
|
|
|
|
| 23 |
|
| 24 |
from .apis.api_tag import newTag
|
| 25 |
from .apis.api_words import words
|
|
|
|
| 20 |
|
| 21 |
from .vocabulary_management.vocabulry_menu import vocabularyMenu
|
| 22 |
from .vocabulary_management.create_vocabulary import createVocabulary
|
| 23 |
+
from .vocabulary_management.list_vocabulary import listVocabulary
|
| 24 |
|
| 25 |
from .apis.api_tag import newTag
|
| 26 |
from .apis.api_words import words
|
tecnicas/views/vocabulary_management/list_vocabulary.py
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from django.http import HttpRequest
|
| 2 |
+
from tecnicas.controllers import ListVocabularyController
|
| 3 |
+
|
| 4 |
+
|
| 5 |
+
def listVocabulary(req: HttpRequest, num_page: int):
|
| 6 |
+
controll_view = ListVocabularyController()
|
| 7 |
+
if req.method == "GET":
|
| 8 |
+
response = controll_view.controllGet(req, num_page)
|
| 9 |
+
return response
|
| 10 |
+
else:
|
| 11 |
+
pass
|