Spaces:
Sleeping
Sleeping
Correccion al crear sesion y listado de sesiones por presentador
Browse files- tecnicas/controllers/models_controller/sesion_controller.py +2 -2
- tecnicas/decorators/required_presenter.py +1 -1
- tecnicas/static/js/panel-words.js +1 -1
- tecnicas/templates/tecnicas/manage_sesions/sesiones-panel.html +1 -1
- tecnicas/views/apis/api_words.py +5 -5
- tecnicas/views/sessions_config/create_session.py +153 -152
- tecnicas/views/sessions_management/sessions_panel.py +4 -3
tecnicas/controllers/models_controller/sesion_controller.py
CHANGED
|
@@ -47,7 +47,7 @@ class SesionController():
|
|
| 47 |
elements_by_page = 6
|
| 48 |
|
| 49 |
try:
|
| 50 |
-
creator = Presentador.objects.get(
|
| 51 |
except Presentador.DoesNotExist:
|
| 52 |
return controller_error("presentador invalido")
|
| 53 |
|
|
@@ -111,7 +111,7 @@ class SesionController():
|
|
| 111 |
@staticmethod
|
| 112 |
def getNumberSessionsByCreator(user_name: str):
|
| 113 |
try:
|
| 114 |
-
creator = Presentador.objects.get(
|
| 115 |
|
| 116 |
number_sessions = SesionSensorial.objects.filter(
|
| 117 |
creadoPor=creator).count()
|
|
|
|
| 47 |
elements_by_page = 6
|
| 48 |
|
| 49 |
try:
|
| 50 |
+
creator = Presentador.objects.get(user__username=user_name)
|
| 51 |
except Presentador.DoesNotExist:
|
| 52 |
return controller_error("presentador invalido")
|
| 53 |
|
|
|
|
| 111 |
@staticmethod
|
| 112 |
def getNumberSessionsByCreator(user_name: str):
|
| 113 |
try:
|
| 114 |
+
creator = Presentador.objects.get(user__username=user_name)
|
| 115 |
|
| 116 |
number_sessions = SesionSensorial.objects.filter(
|
| 117 |
creadoPor=creator).count()
|
tecnicas/decorators/required_presenter.py
CHANGED
|
@@ -8,7 +8,7 @@ def required_presenter(view_func):
|
|
| 8 |
if not request.user.is_authenticated:
|
| 9 |
return redirect("cata_system:autenticacion")
|
| 10 |
|
| 11 |
-
if not hasattr(request.user, "
|
| 12 |
raise PermissionDenied(
|
| 13 |
"Solo los presentadores pueden acceder a esta vista")
|
| 14 |
return view_func(request, *args, **kwargs)
|
|
|
|
| 8 |
if not request.user.is_authenticated:
|
| 9 |
return redirect("cata_system:autenticacion")
|
| 10 |
|
| 11 |
+
if not hasattr(request.user, "user_presentador"):
|
| 12 |
raise PermissionDenied(
|
| 13 |
"Solo los presentadores pueden acceder a esta vista")
|
| 14 |
return view_func(request, *args, **kwargs)
|
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 = `/cata/api/palabras?${params}`;
|
| 32 |
|
| 33 |
try {
|
| 34 |
const respone = await fetch(url, {
|
tecnicas/templates/tecnicas/manage_sesions/sesiones-panel.html
CHANGED
|
@@ -25,7 +25,7 @@
|
|
| 25 |
|
| 26 |
<section class="grid grid-cols-3 max-lg:grid-cols-2 max-sm:grid-cols-1 w-full gap-4 justify-center">
|
| 27 |
{% for sesion in sessions %}
|
| 28 |
-
{% include "
|
| 29 |
{% endfor %}
|
| 30 |
</section>
|
| 31 |
|
|
|
|
| 25 |
|
| 26 |
<section class="grid grid-cols-3 max-lg:grid-cols-2 max-sm:grid-cols-1 w-full gap-4 justify-center">
|
| 27 |
{% for sesion in sessions %}
|
| 28 |
+
{% include "../components/item_session.html" with sesion=sesion %}
|
| 29 |
{% endfor %}
|
| 30 |
</section>
|
| 31 |
|
tecnicas/views/apis/api_words.py
CHANGED
|
@@ -1,10 +1,10 @@
|
|
| 1 |
from django.http import HttpRequest, JsonResponse
|
| 2 |
-
from
|
| 3 |
-
from
|
| 4 |
-
from
|
| 5 |
-
from
|
| 6 |
-
|
| 7 |
|
|
|
|
| 8 |
def words(req: HttpRequest):
|
| 9 |
if req.method == "GET":
|
| 10 |
try:
|
|
|
|
| 1 |
from django.http import HttpRequest, JsonResponse
|
| 2 |
+
from tecnicas.decorators import required_presenter
|
| 3 |
+
from tecnicas.models import Palabra
|
| 4 |
+
from tecnicas.utils import general_error
|
| 5 |
+
from tecnicas.forms.word_form import WordForm
|
|
|
|
| 6 |
|
| 7 |
+
@required_presenter
|
| 8 |
def words(req: HttpRequest):
|
| 9 |
if req.method == "GET":
|
| 10 |
try:
|
tecnicas/views/sessions_config/create_session.py
CHANGED
|
@@ -1,9 +1,9 @@
|
|
| 1 |
from django.http import HttpRequest, JsonResponse
|
| 2 |
-
from django.shortcuts import render
|
| 3 |
-
from django.urls import reverse
|
| 4 |
from ...utils import general_error
|
| 5 |
from ...controllers import TecnicaController, EscalaController, ProductosController, OrdenesController, EstiloPalabrasController, PalabrasController, SesionController
|
| 6 |
from ...models import Presentador
|
|
|
|
| 7 |
|
| 8 |
|
| 9 |
def createSession(req: HttpRequest):
|
|
@@ -15,155 +15,156 @@ def createSession(req: HttpRequest):
|
|
| 15 |
req.session.flush()
|
| 16 |
return general_error("no se ha especificado informacion necesaria para la creacion de la sesion")
|
| 17 |
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
controllerScale = EscalaController(data=data_scale)
|
| 38 |
-
|
| 39 |
-
scale = controllerScale.saveScale()
|
| 40 |
-
if isinstance(scale, dict):
|
| 41 |
-
controllerTechnique.deleteTechnique()
|
| 42 |
-
return general_error(scale["error"])
|
| 43 |
-
|
| 44 |
-
dict_tags = req.session["form_tags"]
|
| 45 |
-
saved_related_tags = controllerScale.realteTags(dict_tags)
|
| 46 |
-
if "error" in saved_related_tags:
|
| 47 |
-
return general_error(saved_related_tags["error"])
|
| 48 |
-
|
| 49 |
-
# ////////////////////////////////////////////////////////// #
|
| 50 |
-
#
|
| 51 |
-
# Second step: Create orders, productos and set the position #
|
| 52 |
-
#
|
| 53 |
-
# ////////////////////////////////////////////////////////// #
|
| 54 |
-
data_codes = req.session["form_codes"]
|
| 55 |
-
|
| 56 |
-
list_codes_dict = data_codes["product_codes"]
|
| 57 |
-
|
| 58 |
-
codes = []
|
| 59 |
-
for product in list_codes_dict:
|
| 60 |
-
code = next(iter(product.values()))
|
| 61 |
-
codes.append(code)
|
| 62 |
-
|
| 63 |
-
controllerProducts = ProductosController(
|
| 64 |
-
codes=codes,
|
| 65 |
-
technique=technique
|
| 66 |
-
)
|
| 67 |
-
|
| 68 |
-
controllerProducts.setProductsNoSave()
|
| 69 |
-
saved_prodcuts = controllerProducts.saveProducts()
|
| 70 |
-
if isinstance(saved_prodcuts, dict):
|
| 71 |
-
controllerTechnique.deleteTechnique()
|
| 72 |
-
return general_error(saved_prodcuts["error"])
|
| 73 |
-
|
| 74 |
-
raw_sort_codes = data_codes["sort_codes"]
|
| 75 |
-
controllerOrdes = OrdenesController(
|
| 76 |
-
raw_orders=raw_sort_codes,
|
| 77 |
-
list_products=saved_prodcuts,
|
| 78 |
-
technique=technique
|
| 79 |
-
)
|
| 80 |
-
|
| 81 |
-
controllerOrdes.setOrdersToSave()
|
| 82 |
-
saved_orders = controllerOrdes.saveOrders()
|
| 83 |
-
if isinstance(saved_orders, dict):
|
| 84 |
-
controllerTechnique.deleteTechnique()
|
| 85 |
-
return general_error(saved_orders["error"])
|
| 86 |
-
|
| 87 |
-
seded_positions = controllerOrdes.setPositions()
|
| 88 |
-
if isinstance(seded_positions, dict):
|
| 89 |
-
controllerTechnique.deleteTechnique()
|
| 90 |
-
return general_error(seded_positions["error"])
|
| 91 |
-
|
| 92 |
-
saved_postions = controllerOrdes.savePositions()
|
| 93 |
-
if isinstance(saved_postions, dict):
|
| 94 |
-
controllerTechnique.deleteTechnique()
|
| 95 |
-
return general_error(saved_prodcuts["error"])
|
| 96 |
-
|
| 97 |
-
# /////////////////////////////////////////////////////// #
|
| 98 |
-
#
|
| 99 |
-
# Third step: Create relations technique with Words Style #
|
| 100 |
-
#
|
| 101 |
-
# /////////////////////////////////////////////////////// #
|
| 102 |
-
ids_words = req.session["form_words"]
|
| 103 |
-
words_controller = PalabrasController(ids=ids_words)
|
| 104 |
-
|
| 105 |
-
words_to_use = words_controller.setWords()
|
| 106 |
-
if isinstance(words_to_use, dict):
|
| 107 |
-
controllerTechnique.deleteTechnique()
|
| 108 |
-
return general_error(words_to_use["error"])
|
| 109 |
-
|
| 110 |
-
style_controller = EstiloPalabrasController(
|
| 111 |
-
technique=technique, words=words_to_use)
|
| 112 |
-
|
| 113 |
-
instace_style = style_controller.createAndSaveInstaceStyle()
|
| 114 |
-
if isinstance(instace_style, dict):
|
| 115 |
-
controllerTechnique.deleteTechnique()
|
| 116 |
-
return general_error(instace_style["error"])
|
| 117 |
-
|
| 118 |
-
words_using = style_controller.relatedWords()
|
| 119 |
-
if isinstance(words_using, dict):
|
| 120 |
-
controllerTechnique.deleteTechnique()
|
| 121 |
-
return general_error(words_using["error"])
|
| 122 |
-
|
| 123 |
-
# //////////////////////////////////////////////////////// #
|
| 124 |
-
#
|
| 125 |
-
# Fourth step: Create session and relat with the technique #
|
| 126 |
-
#
|
| 127 |
-
# //////////////////////////////////////////////////////// #
|
| 128 |
-
session_controller = SesionController(
|
| 129 |
-
name_session=data_basic["nombre_sesion"] if data_basic["nombre_sesion"] != "" else None,
|
| 130 |
-
technique=technique,
|
| 131 |
-
creator=Presentador.objects.get(nombre_usuario="aguBido")
|
| 132 |
-
)
|
| 133 |
-
|
| 134 |
-
setting_session = session_controller.setSession()
|
| 135 |
-
if isinstance(setting_session, dict):
|
| 136 |
-
controllerTechnique.deleteTechnique()
|
| 137 |
-
return general_error(setting_session["error"])
|
| 138 |
-
|
| 139 |
-
saved_session = session_controller.saveSession()
|
| 140 |
-
if isinstance(saved_session, dict):
|
| 141 |
-
return general_error(saved_session["error"])
|
| 142 |
-
|
| 143 |
-
context = {
|
| 144 |
-
"message": "sesion creada",
|
| 145 |
-
"data": {
|
| 146 |
-
"codigo_sesion": saved_session.codigo_sesion,
|
| 147 |
-
"nombre_sesion": saved_session.nombre_sesion
|
| 148 |
}
|
| 149 |
-
|
| 150 |
-
|
| 151 |
-
|
| 152 |
-
|
| 153 |
-
|
| 154 |
-
|
| 155 |
-
|
| 156 |
-
|
| 157 |
-
|
| 158 |
-
|
| 159 |
-
"
|
| 160 |
-
|
| 161 |
-
|
| 162 |
-
|
| 163 |
-
|
| 164 |
-
|
| 165 |
-
|
| 166 |
-
|
| 167 |
-
|
| 168 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 169 |
return general_error("ha orcurrido un error inesperado")
|
|
|
|
| 1 |
from django.http import HttpRequest, JsonResponse
|
| 2 |
+
from django.shortcuts import render
|
|
|
|
| 3 |
from ...utils import general_error
|
| 4 |
from ...controllers import TecnicaController, EscalaController, ProductosController, OrdenesController, EstiloPalabrasController, PalabrasController, SesionController
|
| 5 |
from ...models import Presentador
|
| 6 |
+
from django.db import transaction
|
| 7 |
|
| 8 |
|
| 9 |
def createSession(req: HttpRequest):
|
|
|
|
| 15 |
req.session.flush()
|
| 16 |
return general_error("no se ha especificado informacion necesaria para la creacion de la sesion")
|
| 17 |
|
| 18 |
+
with transaction.atomic():
|
| 19 |
+
# ////////////////////////////////////////////////////// #
|
| 20 |
+
#
|
| 21 |
+
# First step: Create technique and scale with their tags #
|
| 22 |
+
#
|
| 23 |
+
# ////////////////////////////////////////////////////// #
|
| 24 |
+
data_basic = req.session["form_basic"]
|
| 25 |
+
controllerTechnique = TecnicaController()
|
| 26 |
+
controllerTechnique.setTechniqueFromBasicData(basic=data_basic)
|
| 27 |
+
|
| 28 |
+
technique = controllerTechnique.saveTechnique()
|
| 29 |
+
if not technique:
|
| 30 |
+
return general_error("error al guardar la tecnica")
|
| 31 |
+
|
| 32 |
+
data_scale = {
|
| 33 |
+
"id_scale": data_basic["tipo_escala"],
|
| 34 |
+
"size": data_basic["tamano_escala"],
|
| 35 |
+
"technique": technique
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
}
|
| 37 |
+
|
| 38 |
+
controllerScale = EscalaController(data=data_scale)
|
| 39 |
+
|
| 40 |
+
scale = controllerScale.saveScale()
|
| 41 |
+
if isinstance(scale, dict):
|
| 42 |
+
controllerTechnique.deleteTechnique()
|
| 43 |
+
return general_error(scale["error"])
|
| 44 |
+
|
| 45 |
+
dict_tags = req.session["form_tags"]
|
| 46 |
+
saved_related_tags = controllerScale.realteTags(dict_tags)
|
| 47 |
+
if "error" in saved_related_tags:
|
| 48 |
+
return general_error(saved_related_tags["error"])
|
| 49 |
+
|
| 50 |
+
# ////////////////////////////////////////////////////////// #
|
| 51 |
+
#
|
| 52 |
+
# Second step: Create orders, productos and set the position #
|
| 53 |
+
#
|
| 54 |
+
# ////////////////////////////////////////////////////////// #
|
| 55 |
+
data_codes = req.session["form_codes"]
|
| 56 |
+
|
| 57 |
+
list_codes_dict = data_codes["product_codes"]
|
| 58 |
+
|
| 59 |
+
codes = []
|
| 60 |
+
for product in list_codes_dict:
|
| 61 |
+
code = next(iter(product.values()))
|
| 62 |
+
codes.append(code)
|
| 63 |
+
|
| 64 |
+
controllerProducts = ProductosController(
|
| 65 |
+
codes=codes,
|
| 66 |
+
technique=technique
|
| 67 |
+
)
|
| 68 |
+
|
| 69 |
+
controllerProducts.setProductsNoSave()
|
| 70 |
+
saved_prodcuts = controllerProducts.saveProducts()
|
| 71 |
+
if isinstance(saved_prodcuts, dict):
|
| 72 |
+
controllerTechnique.deleteTechnique()
|
| 73 |
+
return general_error(saved_prodcuts["error"])
|
| 74 |
+
|
| 75 |
+
raw_sort_codes = data_codes["sort_codes"]
|
| 76 |
+
controllerOrdes = OrdenesController(
|
| 77 |
+
raw_orders=raw_sort_codes,
|
| 78 |
+
list_products=saved_prodcuts,
|
| 79 |
+
technique=technique
|
| 80 |
+
)
|
| 81 |
+
|
| 82 |
+
controllerOrdes.setOrdersToSave()
|
| 83 |
+
saved_orders = controllerOrdes.saveOrders()
|
| 84 |
+
if isinstance(saved_orders, dict):
|
| 85 |
+
controllerTechnique.deleteTechnique()
|
| 86 |
+
return general_error(saved_orders["error"])
|
| 87 |
+
|
| 88 |
+
seded_positions = controllerOrdes.setPositions()
|
| 89 |
+
if isinstance(seded_positions, dict):
|
| 90 |
+
controllerTechnique.deleteTechnique()
|
| 91 |
+
return general_error(seded_positions["error"])
|
| 92 |
+
|
| 93 |
+
saved_postions = controllerOrdes.savePositions()
|
| 94 |
+
if isinstance(saved_postions, dict):
|
| 95 |
+
controllerTechnique.deleteTechnique()
|
| 96 |
+
return general_error(saved_prodcuts["error"])
|
| 97 |
+
|
| 98 |
+
# /////////////////////////////////////////////////////// #
|
| 99 |
+
#
|
| 100 |
+
# Third step: Create relations technique with Words Style #
|
| 101 |
+
#
|
| 102 |
+
# /////////////////////////////////////////////////////// #
|
| 103 |
+
ids_words = req.session["form_words"]
|
| 104 |
+
words_controller = PalabrasController(ids=ids_words)
|
| 105 |
+
|
| 106 |
+
words_to_use = words_controller.setWords()
|
| 107 |
+
if isinstance(words_to_use, dict):
|
| 108 |
+
controllerTechnique.deleteTechnique()
|
| 109 |
+
return general_error(words_to_use["error"])
|
| 110 |
+
|
| 111 |
+
style_controller = EstiloPalabrasController(
|
| 112 |
+
technique=technique, words=words_to_use)
|
| 113 |
+
|
| 114 |
+
instace_style = style_controller.createAndSaveInstaceStyle()
|
| 115 |
+
if isinstance(instace_style, dict):
|
| 116 |
+
controllerTechnique.deleteTechnique()
|
| 117 |
+
return general_error(instace_style["error"])
|
| 118 |
+
|
| 119 |
+
words_using = style_controller.relatedWords()
|
| 120 |
+
if isinstance(words_using, dict):
|
| 121 |
+
controllerTechnique.deleteTechnique()
|
| 122 |
+
return general_error(words_using["error"])
|
| 123 |
+
|
| 124 |
+
# //////////////////////////////////////////////////////// #
|
| 125 |
+
#
|
| 126 |
+
# Fourth step: Create session and relat with the technique #
|
| 127 |
+
#
|
| 128 |
+
# //////////////////////////////////////////////////////// #
|
| 129 |
+
session_controller = SesionController(
|
| 130 |
+
name_session=data_basic["nombre_sesion"] if data_basic["nombre_sesion"] != "" else None,
|
| 131 |
+
technique=technique,
|
| 132 |
+
creator=req.user.user_presentador
|
| 133 |
+
)
|
| 134 |
+
|
| 135 |
+
setting_session = session_controller.setSession()
|
| 136 |
+
if isinstance(setting_session, dict):
|
| 137 |
+
controllerTechnique.deleteTechnique()
|
| 138 |
+
return general_error(setting_session["error"])
|
| 139 |
+
|
| 140 |
+
saved_session = session_controller.saveSession()
|
| 141 |
+
if isinstance(saved_session, dict):
|
| 142 |
+
return general_error(saved_session["error"])
|
| 143 |
+
|
| 144 |
+
context = {
|
| 145 |
+
"message": "sesion creada",
|
| 146 |
+
"data": {
|
| 147 |
+
"codigo_sesion": saved_session.codigo_sesion,
|
| 148 |
+
"nombre_sesion": saved_session.nombre_sesion
|
| 149 |
+
}
|
| 150 |
+
}
|
| 151 |
+
|
| 152 |
+
# /////////////////////////////// #
|
| 153 |
+
#
|
| 154 |
+
# Final step: Delete session keys #
|
| 155 |
+
#
|
| 156 |
+
# /////////////////////////////// #
|
| 157 |
+
|
| 158 |
+
keys_forms = [
|
| 159 |
+
"form_basic",
|
| 160 |
+
"form_tags",
|
| 161 |
+
"form_codes",
|
| 162 |
+
"form_words"
|
| 163 |
+
]
|
| 164 |
+
|
| 165 |
+
for key in keys_forms:
|
| 166 |
+
if key in req.session:
|
| 167 |
+
del req.session[key]
|
| 168 |
+
|
| 169 |
+
return JsonResponse(context)
|
| 170 |
return general_error("ha orcurrido un error inesperado")
|
tecnicas/views/sessions_management/sessions_panel.py
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
|
|
| 1 |
from django.shortcuts import render
|
| 2 |
from ...controllers import SesionController
|
| 3 |
|
| 4 |
|
| 5 |
-
def sesionsPanel(req, page: int):
|
| 6 |
context = {"num_page": page}
|
| 7 |
|
| 8 |
(sessions_in_page, last_page) = SesionController.getSessionsSavesByCretor(
|
| 9 |
-
user_name=
|
| 10 |
|
| 11 |
if isinstance(sessions_in_page, dict):
|
| 12 |
context["error"] = sessions_in_page["error"]
|
|
@@ -16,7 +17,7 @@ def sesionsPanel(req, page: int):
|
|
| 16 |
context["last_page"] = last_page
|
| 17 |
|
| 18 |
number_pages = SesionController.getNumberSessionsByCreator(
|
| 19 |
-
user_name=
|
| 20 |
if isinstance(number_pages, dict):
|
| 21 |
context["num_paginas"] = sessions_in_page["error"]
|
| 22 |
return render(req, "tecnicas/manage_sesions/sesiones-panel.html", context=context)
|
|
|
|
| 1 |
+
from django.http import HttpRequest
|
| 2 |
from django.shortcuts import render
|
| 3 |
from ...controllers import SesionController
|
| 4 |
|
| 5 |
|
| 6 |
+
def sesionsPanel(req:HttpRequest, page: int):
|
| 7 |
context = {"num_page": page}
|
| 8 |
|
| 9 |
(sessions_in_page, last_page) = SesionController.getSessionsSavesByCretor(
|
| 10 |
+
user_name=req.user.username, page=page)
|
| 11 |
|
| 12 |
if isinstance(sessions_in_page, dict):
|
| 13 |
context["error"] = sessions_in_page["error"]
|
|
|
|
| 17 |
context["last_page"] = last_page
|
| 18 |
|
| 19 |
number_pages = SesionController.getNumberSessionsByCreator(
|
| 20 |
+
user_name=req.user.username)
|
| 21 |
if isinstance(number_pages, dict):
|
| 22 |
context["num_paginas"] = sessions_in_page["error"]
|
| 23 |
return render(req, "tecnicas/manage_sesions/sesiones-panel.html", context=context)
|