Spaces:
Running
Running
Creacion de Vocabularios
Browse files- tecnicas/admin.py +2 -1
- tecnicas/controllers/__init__.py +2 -0
- tecnicas/controllers/views_controller/vocabulary_manage/create_vocabulary_controller.py +68 -0
- tecnicas/static/js/created-vocabulary.js +26 -0
- tecnicas/static/js/panel-words.js +1 -1
- tecnicas/templates/tecnicas/manage_vocabulary/create-vocabulary.html +132 -0
- tecnicas/templates/tecnicas/manage_vocabulary/panel-vocabulary.html +1 -1
- tecnicas/urls.py +8 -4
- tecnicas/views/__init__.py +2 -1
- tecnicas/views/vocabulary_management/create_vocabulary.py +19 -0
- tecnicas/views/{vocabulry_management → vocabulary_management}/vocabulry_menu.py +0 -0
tecnicas/admin.py
CHANGED
|
@@ -6,7 +6,7 @@ from .models import Catador, Presentador
|
|
| 6 |
|
| 7 |
from .models import Tecnica, SesionSensorial
|
| 8 |
|
| 9 |
-
from .models import EsAtributo, Palabra
|
| 10 |
|
| 11 |
from .models import Etiqueta, Escala, EtiquetasEscala
|
| 12 |
|
|
@@ -31,6 +31,7 @@ admin.site.register(SesionSensorial)
|
|
| 31 |
|
| 32 |
admin.site.register(EsAtributo)
|
| 33 |
admin.site.register(Palabra)
|
|
|
|
| 34 |
|
| 35 |
admin.site.register(Escala)
|
| 36 |
admin.site.register(EtiquetasEscala)
|
|
|
|
| 6 |
|
| 7 |
from .models import Tecnica, SesionSensorial
|
| 8 |
|
| 9 |
+
from .models import EsAtributo, Palabra, Vocabulario
|
| 10 |
|
| 11 |
from .models import Etiqueta, Escala, EtiquetasEscala
|
| 12 |
|
|
|
|
| 31 |
|
| 32 |
admin.site.register(EsAtributo)
|
| 33 |
admin.site.register(Palabra)
|
| 34 |
+
admin.site.register(Vocabulario)
|
| 35 |
|
| 36 |
admin.site.register(Escala)
|
| 37 |
admin.site.register(EtiquetasEscala)
|
tecnicas/controllers/__init__.py
CHANGED
|
@@ -29,6 +29,8 @@ from .views_controller.sessions_tester.login_session_tester_controller import Lo
|
|
| 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.api_rating_controller import ApiRatingController
|
| 33 |
from .views_controller.tester_list_controller import TesterListController
|
| 34 |
from .views_controller.list_sessions_tester_controller import ListSessionsTesterController
|
|
|
|
| 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
|
tecnicas/controllers/views_controller/vocabulary_manage/create_vocabulary_controller.py
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from django.shortcuts import render
|
| 2 |
+
from django.db import IntegrityError
|
| 3 |
+
from django.http import HttpRequest
|
| 4 |
+
from tecnicas.forms import WordForm
|
| 5 |
+
from tecnicas.models import Vocabulario, Palabra
|
| 6 |
+
import json
|
| 7 |
+
|
| 8 |
+
|
| 9 |
+
class CreateVocabularyController():
|
| 10 |
+
context = {}
|
| 11 |
+
current_url = "tecnicas/manage_vocabulary/create-vocabulary.html"
|
| 12 |
+
|
| 13 |
+
def __init__(self, form_word: WordForm = WordForm(), list_words: list = []):
|
| 14 |
+
self.context["form_word"] = form_word
|
| 15 |
+
self.context["words"] = list_words
|
| 16 |
+
|
| 17 |
+
def controllGet(self, request: HttpRequest):
|
| 18 |
+
self.context = {
|
| 19 |
+
"form_word": self.context["form_word"],
|
| 20 |
+
"words": self.context["words"],
|
| 21 |
+
}
|
| 22 |
+
|
| 23 |
+
if "name_vaca" in request.GET:
|
| 24 |
+
current = Vocabulario.objects.get(nomre_vocabulario=request.GET["name_vaca"])
|
| 25 |
+
|
| 26 |
+
self.context = {
|
| 27 |
+
"name_vacabulary": current.nomre_vocabulario,
|
| 28 |
+
"words": current.palabras.all()
|
| 29 |
+
}
|
| 30 |
+
|
| 31 |
+
return render(request, self.current_url, self.context)
|
| 32 |
+
|
| 33 |
+
def controllPost(self, request: HttpRequest):
|
| 34 |
+
self.context = {
|
| 35 |
+
"form_word": self.context["form_word"],
|
| 36 |
+
"words": self.context["words"],
|
| 37 |
+
}
|
| 38 |
+
|
| 39 |
+
if "nombre_vocabulario" not in request.POST:
|
| 40 |
+
self.context["error"] = "Nombre de vocabulario requerido"
|
| 41 |
+
return render(request, self.current_url, self.context)
|
| 42 |
+
|
| 43 |
+
vocabulary_name = request.POST.get("nombre_vocabulario").strip()
|
| 44 |
+
|
| 45 |
+
try:
|
| 46 |
+
new_vocababulary = Vocabulario.objects.create(
|
| 47 |
+
nomre_vocabulario=vocabulary_name)
|
| 48 |
+
except IntegrityError:
|
| 49 |
+
self.context["error"] = "Ya existe un vocabulario con ese nombre"
|
| 50 |
+
return render(request, self.current_url, self.context)
|
| 51 |
+
|
| 52 |
+
words_json = request.POST.get("words", "")
|
| 53 |
+
if words_json:
|
| 54 |
+
try:
|
| 55 |
+
words_list = json.loads(words_json)
|
| 56 |
+
|
| 57 |
+
ids = [int(w.get("id", 0))
|
| 58 |
+
for w in words_list if str(w.get("id", "")).isdigit()]
|
| 59 |
+
|
| 60 |
+
words = Palabra.objects.filter(id__in=ids)
|
| 61 |
+
|
| 62 |
+
new_vocababulary.palabras.add(*words)
|
| 63 |
+
except (json.JSONDecodeError, ValueError):
|
| 64 |
+
self.context["error"] = 'Ocurrió un error al revisar las palabras, revise “Ver vocabularios”, para reasignar las palabras'
|
| 65 |
+
return render(request, self.current_url, self.context)
|
| 66 |
+
|
| 67 |
+
self.context["message"] = 'Vocabulario creado con éxito, puedes revisarlo en "Ver vocabularios"'
|
| 68 |
+
return render(request, self.current_url, self.context)
|
tecnicas/static/js/created-vocabulary.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// **************************************
|
| 2 |
+
// Create Vocabulary
|
| 3 |
+
// **************************************
|
| 4 |
+
async function submitSelectWords(classNanmeForm) {
|
| 5 |
+
const form = document.querySelector(`.${classNanmeForm}`);
|
| 6 |
+
|
| 7 |
+
const name_vocabulary = form.querySelector(".cts-name-voca").value;
|
| 8 |
+
if (!name_vocabulary || name_vocabulary == "") {
|
| 9 |
+
spanNotificationRed("Se requiere el nombre del vocabulario");
|
| 10 |
+
return;
|
| 11 |
+
}
|
| 12 |
+
|
| 13 |
+
if (listWordsSelect.length === 0) {
|
| 14 |
+
spanNotificationRed("Debe seleccionar al menos una palabra");
|
| 15 |
+
return;
|
| 16 |
+
}
|
| 17 |
+
|
| 18 |
+
const wordsInput = document.createElement("input");
|
| 19 |
+
wordsInput.type = "hidden";
|
| 20 |
+
wordsInput.name = "words";
|
| 21 |
+
wordsInput.value = JSON.stringify(listWordsSelect);
|
| 22 |
+
|
| 23 |
+
form.appendChild(wordsInput);
|
| 24 |
+
|
| 25 |
+
form.submit();
|
| 26 |
+
}
|
tecnicas/static/js/panel-words.js
CHANGED
|
@@ -28,7 +28,7 @@ async function getWordsByName(e) {
|
|
| 28 |
palabra: dataForm.get("search").trim(),
|
| 29 |
});
|
| 30 |
|
| 31 |
-
const url =
|
| 32 |
|
| 33 |
try {
|
| 34 |
const respone = await fetch(url, {
|
|
|
|
| 28 |
palabra: dataForm.get("search").trim(),
|
| 29 |
});
|
| 30 |
|
| 31 |
+
const url = `api/palabras?${params}`;
|
| 32 |
|
| 33 |
try {
|
| 34 |
const respone = await fetch(url, {
|
tecnicas/templates/tecnicas/manage_vocabulary/create-vocabulary.html
ADDED
|
@@ -0,0 +1,132 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{% extends 'tecnicas/layouts/base.html' %}
|
| 2 |
+
{% load static %}
|
| 3 |
+
|
| 4 |
+
{% block title %}Crear vocabulario{% endblock %}
|
| 5 |
+
|
| 6 |
+
{% block content %}
|
| 7 |
+
<article class="cts-container-main">
|
| 8 |
+
<article
|
| 9 |
+
class="ct-notification-red absolute max-md:fixed bottom-0 mb-4 left-1/2 -translate-x-1/2 bg-red-400 text-white p-2 px-4 rounded-lg text-center font-bold hidden uppercase traking-wide">
|
| 10 |
+
</article>
|
| 11 |
+
<article
|
| 12 |
+
class="ct-notification-green absolute max-md:fixed bottom-0 mb-4 left-1/2 -translate-x-1/2 bg-green-600 text-white p-2 px-4 rounded-lg text-center font-medium hidden uppercase">
|
| 13 |
+
</article>
|
| 14 |
+
|
| 15 |
+
<article class="cts-wrap-content text-black lg:w-4xl space-y-4">
|
| 16 |
+
<h1 class="w-full text-center font-bold text-4xl bg-surface-card py-8 rounded-lg">Crear vocabulario</h1>
|
| 17 |
+
|
| 18 |
+
{% if error %}
|
| 19 |
+
{% include "../components/error-message.html" with message=error %}
|
| 20 |
+
{% endif %}
|
| 21 |
+
{% if message %}
|
| 22 |
+
{% include "../components/error-message.html" with message=message %}
|
| 23 |
+
{% endif %}
|
| 24 |
+
|
| 25 |
+
<article class="rounded-lg space-y-4 w-full">
|
| 26 |
+
<form action="" method="post" class="cts-craed-vocabulary bg-surface-card p-4 rounded-lg">
|
| 27 |
+
{% csrf_token %}
|
| 28 |
+
<label for="nombre_vocabulario" class="font-bold text-2xl mb-2 block">Nombre del vocabulario</label>
|
| 29 |
+
{% if name_vacabulary %}
|
| 30 |
+
<input id="nombre_vocabulario" name="nombre_vocabulario" type="text" required
|
| 31 |
+
class="cts-name-voca p-2 px-4 bg-surface-ligt rounded-lg w-full text-lg font-medium"
|
| 32 |
+
placeholder="Ingrese un nombre" value="{{ name_vacabulary }}">
|
| 33 |
+
{% else %}
|
| 34 |
+
<input id="nombre_vocabulario" name="nombre_vocabulario" type="text" required
|
| 35 |
+
class="cts-name-voca p-2 px-4 bg-surface-ligt rounded-lg w-full text-lg font-medium"
|
| 36 |
+
placeholder="Ingrese un nombre">
|
| 37 |
+
{% endif %}
|
| 38 |
+
<p class="text-lg mt-2 font-semibold">Debajo puede buscar y seleccionar palabras para asignarlas a
|
| 39 |
+
este vocabulario.</p>
|
| 40 |
+
</form>
|
| 41 |
+
|
| 42 |
+
<article class="flex flex-col md:flex-row gap-5 justify-between">
|
| 43 |
+
<section class="flex-3/5 flex flex-col gap-4 min-h-96 max-h-96">
|
| 44 |
+
<form action="" method="get" class="ct-serach-words bg-surface-card p-4 rounded-lg">
|
| 45 |
+
{% csrf_token %}
|
| 46 |
+
<p class="text-lg font-semibold mb-2">
|
| 47 |
+
Dejar en blaco para buscar las primeras 10 palabras
|
| 48 |
+
</p>
|
| 49 |
+
<section class="flex flex-row gap-2">
|
| 50 |
+
<label for="search" class="w-full">
|
| 51 |
+
<input type="text" name="search" id="search" placeholder="Buscar palabra"
|
| 52 |
+
class="p-2 px-4 bg-surface-ligt rounded-lg w-full text-lg font-medium">
|
| 53 |
+
</label>
|
| 54 |
+
<button type="submit"
|
| 55 |
+
class="font-bold rounded-lg text-xl px-3 text-center cts-btn-tertiary btn-push">
|
| 56 |
+
Buscar
|
| 57 |
+
</button>
|
| 58 |
+
</section>
|
| 59 |
+
</form>
|
| 60 |
+
<p class="ct-error-words hidden capitalize bg-red-600 text-center text-2xl p-1.5 rounded">
|
| 61 |
+
error</p>
|
| 62 |
+
<ul class="ct-palabras-encontradas gap-2 grid-cols-2 overflow-y-auto">
|
| 63 |
+
<div class="flex justify-center items-center">
|
| 64 |
+
<img src="{% static 'img/lupa.svg' %}" alt="lupa de busqueda" style="width: 50%;">
|
| 65 |
+
</div>
|
| 66 |
+
</ul>
|
| 67 |
+
</section>
|
| 68 |
+
|
| 69 |
+
<section
|
| 70 |
+
class="flex-1/3 bg-surface-card p-4 rounded-lg text-center min-h-96 max-h-96 flex flex-col overflow-hidden">
|
| 71 |
+
<div>
|
| 72 |
+
<p class="text-xl font-bold pb-3">Lista de palabras</p>
|
| 73 |
+
<hr class="mb-3">
|
| 74 |
+
</div>
|
| 75 |
+
<ul class="ct-palabras-usadas flex flex-col gap-3 overflow-y-auto max-h-full">
|
| 76 |
+
{% if not words %}
|
| 77 |
+
<img src="{% static 'img/list.svg' %}" alt="lista de palabras" class="ct-img-list">
|
| 78 |
+
{% endif %}
|
| 79 |
+
{% for word in words %}
|
| 80 |
+
<li
|
| 81 |
+
class="bg-gray-400 text-black rounded font-bold text-lg px-4 py-3 flex flex-wrap flex-row flex-1 min-w-fit justify-center items-center gap-3">
|
| 82 |
+
<p class="ct-word-received" id="{{ word.id }}">{{ word.nombre_palabra }}</p>
|
| 83 |
+
<button
|
| 84 |
+
class="px-4 border-b-2 active:border-b-0 active:border-t-2 transition-all rounded-xl font-black w-fit capitalize active:border-red-500 border-red-800 bg-red-500">➖</button>
|
| 85 |
+
</li>
|
| 86 |
+
{% endfor %}
|
| 87 |
+
</ul>
|
| 88 |
+
</section>
|
| 89 |
+
</article>
|
| 90 |
+
|
| 91 |
+
<form method="post" action="" class="ct-form-new-word p-4 bg-surface-card rounded-lg">
|
| 92 |
+
{% csrf_token %}
|
| 93 |
+
<p class="mb-2 font-bold text-2xl">¿No encuentras una palabra?</p>
|
| 94 |
+
<section class="flex gap-4 flex-wrap justify-center">
|
| 95 |
+
<label for="{{ form_word.nombre_palabra.id_for_label }}"
|
| 96 |
+
class="font-medium w-fit text-xl flex-1 *:w-full *:h-full">
|
| 97 |
+
{{ form_word.nombre_palabra }}
|
| 98 |
+
</label>
|
| 99 |
+
<button class="cts-btn-general-compress cts-btn-primary btn-push p-2 flex-1" type="submit">
|
| 100 |
+
Crear y agregar a la lista
|
| 101 |
+
</button>
|
| 102 |
+
</section>
|
| 103 |
+
<p class="ct-error-word mb-4 font-bold bg-red-500 text-md capitalize text-center rounded hidden">
|
| 104 |
+
error
|
| 105 |
+
</p>
|
| 106 |
+
</form>
|
| 107 |
+
|
| 108 |
+
<article class="flex justify-center gap-4 mt-4">
|
| 109 |
+
<button type="button" name="start" class="cts-btn-general cts-btn-primary btn-push flex-1 w-full"
|
| 110 |
+
onclick="submitSelectWords('cts-craed-vocabulary')">
|
| 111 |
+
{% if name_vacabulary %}
|
| 112 |
+
Actualizar vocabulario
|
| 113 |
+
{% else %}
|
| 114 |
+
Crear vocabulario
|
| 115 |
+
{% endif %}
|
| 116 |
+
</button>
|
| 117 |
+
<a href="{% url 'cata_system:panel_vocabulario' %}" class="flex-1 w-full">
|
| 118 |
+
<button type="button" class="cts-btn-general cts-btn-error btn-push w-full">
|
| 119 |
+
Cancelar
|
| 120 |
+
</button>
|
| 121 |
+
</a>
|
| 122 |
+
</article>
|
| 123 |
+
</article>
|
| 124 |
+
|
| 125 |
+
</article>
|
| 126 |
+
</article>
|
| 127 |
+
{% endblock %}
|
| 128 |
+
|
| 129 |
+
{% block extra_js %}
|
| 130 |
+
<script src="{% static 'js/panel-words.js' %}"></script>
|
| 131 |
+
<script src="{% static 'js/created-vocabulary.js' %}"></script>
|
| 132 |
+
{% endblock %}
|
tecnicas/templates/tecnicas/manage_vocabulary/panel-vocabulary.html
CHANGED
|
@@ -22,7 +22,7 @@
|
|
| 22 |
<img src="{% static 'img/letters.webp' %}" alt="varias personas en fila"
|
| 23 |
class="w-full h-full object-cover rounded-xl">
|
| 24 |
</div>
|
| 25 |
-
<a href="
|
| 26 |
<button class="w-full h-full cts-btn-general cts-btn-primary btn-push">
|
| 27 |
➕ Crear Vocabulario
|
| 28 |
</button>
|
|
|
|
| 22 |
<img src="{% static 'img/letters.webp' %}" alt="varias personas en fila"
|
| 23 |
class="w-full h-full object-cover rounded-xl">
|
| 24 |
</div>
|
| 25 |
+
<a href="{% url 'cata_system:crear_vocabulario' %}" class="flex-1">
|
| 26 |
<button class="w-full h-full cts-btn-general cts-btn-primary btn-push">
|
| 27 |
➕ Crear Vocabulario
|
| 28 |
</button>
|
tecnicas/urls.py
CHANGED
|
@@ -44,10 +44,14 @@ urlpatterns = [
|
|
| 44 |
views.createSession,
|
| 45 |
name="creando_sesion"),
|
| 46 |
|
| 47 |
-
|
| 48 |
path("presenter/panel-vocabulario",
|
| 49 |
views.vocabularyMenu,
|
| 50 |
-
name="panel_vocabulario"),
|
|
|
|
|
|
|
|
|
|
|
|
|
| 51 |
|
| 52 |
# Gestion de catadores
|
| 53 |
path("presenter/panel-catadores",
|
|
@@ -104,11 +108,11 @@ urlpatterns = [
|
|
| 104 |
|
| 105 |
|
| 106 |
# APIs
|
| 107 |
-
path("api/nueva-etiqueta",
|
| 108 |
views.newTag,
|
| 109 |
name="nueva_etiqueta"),
|
| 110 |
|
| 111 |
-
path("api/palabras",
|
| 112 |
views.words,
|
| 113 |
name="api_palabras"),
|
| 114 |
|
|
|
|
| 44 |
views.createSession,
|
| 45 |
name="creando_sesion"),
|
| 46 |
|
| 47 |
+
# Gestion de Vocabularios
|
| 48 |
path("presenter/panel-vocabulario",
|
| 49 |
views.vocabularyMenu,
|
| 50 |
+
name="panel_vocabulario"),
|
| 51 |
+
|
| 52 |
+
path("presenter/crear-vocabulario",
|
| 53 |
+
views.createVocabulary,
|
| 54 |
+
name="crear_vocabulario"),
|
| 55 |
|
| 56 |
# Gestion de catadores
|
| 57 |
path("presenter/panel-catadores",
|
|
|
|
| 108 |
|
| 109 |
|
| 110 |
# APIs
|
| 111 |
+
path("presenter/api/nueva-etiqueta",
|
| 112 |
views.newTag,
|
| 113 |
name="nueva_etiqueta"),
|
| 114 |
|
| 115 |
+
path("presenter/api/palabras",
|
| 116 |
views.words,
|
| 117 |
name="api_palabras"),
|
| 118 |
|
tecnicas/views/__init__.py
CHANGED
|
@@ -18,7 +18,8 @@ from .tester_management.tester_create import testerCreate
|
|
| 18 |
from .tester_management.tester_search import testerSearch
|
| 19 |
from .tester_management.tester_list import testerList
|
| 20 |
|
| 21 |
-
from .
|
|
|
|
| 22 |
|
| 23 |
from .apis.api_tag import newTag
|
| 24 |
from .apis.api_words import words
|
|
|
|
| 18 |
from .tester_management.tester_search import testerSearch
|
| 19 |
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
|
tecnicas/views/vocabulary_management/create_vocabulary.py
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from django.shortcuts import render
|
| 2 |
+
from django.http import HttpRequest
|
| 3 |
+
from tecnicas.forms import WordForm
|
| 4 |
+
from tecnicas.controllers import CreateVocabularyController
|
| 5 |
+
|
| 6 |
+
|
| 7 |
+
def createVocabulary(req: HttpRequest):
|
| 8 |
+
view_controller = CreateVocabularyController()
|
| 9 |
+
if req.method == "GET":
|
| 10 |
+
response = view_controller.controllGet(req)
|
| 11 |
+
return response
|
| 12 |
+
|
| 13 |
+
elif req.method == "POST":
|
| 14 |
+
response = view_controller.controllPost(req)
|
| 15 |
+
return response
|
| 16 |
+
|
| 17 |
+
else:
|
| 18 |
+
context = {"error": "Método no permitido"}
|
| 19 |
+
return render(req, "tecnicas/manage_vocabulary/create-vocabulary.html", context)
|
tecnicas/views/{vocabulry_management → vocabulary_management}/vocabulry_menu.py
RENAMED
|
File without changes
|