From 2c159d81196108b7c1a1fa11c97a8ddcdc5207d7 Mon Sep 17 00:00:00 2001 From: RafaUC Date: Fri, 5 Jul 2024 14:25:20 -0600 Subject: [PATCH 1/3] creacion de los demas modulos base --- cosiap_api/admin/__init__.py | 0 cosiap_api/admin/admin.py | 3 +++ cosiap_api/admin/apps.py | 7 +++++++ cosiap_api/admin/migrations/__init__.py | 0 cosiap_api/admin/models.py | 3 +++ cosiap_api/admin/tests.py | 3 +++ cosiap_api/admin/urls.py | 7 +++++++ cosiap_api/admin/views.py | 3 +++ cosiap_api/cosiap_api/settings.py | 7 +++++++ cosiap_api/cosiap_api/urls.py | 4 ++++ cosiap_api/dynamic_formats/__init__.py | 0 cosiap_api/dynamic_formats/admin.py | 3 +++ cosiap_api/dynamic_formats/apps.py | 6 ++++++ cosiap_api/dynamic_formats/migrations/__init__.py | 0 cosiap_api/dynamic_formats/models.py | 3 +++ cosiap_api/dynamic_formats/tests.py | 3 +++ cosiap_api/dynamic_formats/views.py | 3 +++ cosiap_api/dynamic_forms/__init__.py | 0 cosiap_api/dynamic_forms/admin.py | 3 +++ cosiap_api/dynamic_forms/apps.py | 6 ++++++ cosiap_api/dynamic_forms/migrations/__init__.py | 0 cosiap_api/dynamic_forms/models.py | 3 +++ cosiap_api/dynamic_forms/tests.py | 3 +++ cosiap_api/dynamic_forms/views.py | 3 +++ cosiap_api/dynamic_tables/__init__.py | 0 cosiap_api/dynamic_tables/admin.py | 3 +++ cosiap_api/dynamic_tables/apps.py | 6 ++++++ cosiap_api/dynamic_tables/migrations/__init__.py | 0 cosiap_api/dynamic_tables/models.py | 3 +++ cosiap_api/dynamic_tables/tests.py | 3 +++ cosiap_api/dynamic_tables/views.py | 3 +++ cosiap_api/modalidades/__init__.py | 0 cosiap_api/modalidades/admin.py | 3 +++ cosiap_api/modalidades/apps.py | 6 ++++++ cosiap_api/modalidades/migrations/__init__.py | 0 cosiap_api/modalidades/models.py | 3 +++ cosiap_api/modalidades/tests.py | 3 +++ cosiap_api/modalidades/urls.py | 7 +++++++ cosiap_api/modalidades/views.py | 3 +++ cosiap_api/notificaciones/__init__.py | 0 cosiap_api/notificaciones/admin.py | 3 +++ cosiap_api/notificaciones/apps.py | 6 ++++++ cosiap_api/notificaciones/migrations/__init__.py | 0 cosiap_api/notificaciones/models.py | 3 +++ cosiap_api/notificaciones/tests.py | 3 +++ cosiap_api/notificaciones/urls.py | 7 +++++++ cosiap_api/notificaciones/views.py | 3 +++ cosiap_api/solicitudes/__init__.py | 0 cosiap_api/solicitudes/admin.py | 3 +++ cosiap_api/solicitudes/apps.py | 6 ++++++ cosiap_api/solicitudes/migrations/__init__.py | 0 cosiap_api/solicitudes/models.py | 3 +++ cosiap_api/solicitudes/tests.py | 3 +++ cosiap_api/solicitudes/urls.py | 7 +++++++ cosiap_api/solicitudes/views.py | 3 +++ cosiap_api/users/urls.py | 15 --------------- cosiap_api/users/views.py | 2 +- 57 files changed, 167 insertions(+), 16 deletions(-) create mode 100644 cosiap_api/admin/__init__.py create mode 100644 cosiap_api/admin/admin.py create mode 100644 cosiap_api/admin/apps.py create mode 100644 cosiap_api/admin/migrations/__init__.py create mode 100644 cosiap_api/admin/models.py create mode 100644 cosiap_api/admin/tests.py create mode 100644 cosiap_api/admin/urls.py create mode 100644 cosiap_api/admin/views.py create mode 100644 cosiap_api/dynamic_formats/__init__.py create mode 100644 cosiap_api/dynamic_formats/admin.py create mode 100644 cosiap_api/dynamic_formats/apps.py create mode 100644 cosiap_api/dynamic_formats/migrations/__init__.py create mode 100644 cosiap_api/dynamic_formats/models.py create mode 100644 cosiap_api/dynamic_formats/tests.py create mode 100644 cosiap_api/dynamic_formats/views.py create mode 100644 cosiap_api/dynamic_forms/__init__.py create mode 100644 cosiap_api/dynamic_forms/admin.py create mode 100644 cosiap_api/dynamic_forms/apps.py create mode 100644 cosiap_api/dynamic_forms/migrations/__init__.py create mode 100644 cosiap_api/dynamic_forms/models.py create mode 100644 cosiap_api/dynamic_forms/tests.py create mode 100644 cosiap_api/dynamic_forms/views.py create mode 100644 cosiap_api/dynamic_tables/__init__.py create mode 100644 cosiap_api/dynamic_tables/admin.py create mode 100644 cosiap_api/dynamic_tables/apps.py create mode 100644 cosiap_api/dynamic_tables/migrations/__init__.py create mode 100644 cosiap_api/dynamic_tables/models.py create mode 100644 cosiap_api/dynamic_tables/tests.py create mode 100644 cosiap_api/dynamic_tables/views.py create mode 100644 cosiap_api/modalidades/__init__.py create mode 100644 cosiap_api/modalidades/admin.py create mode 100644 cosiap_api/modalidades/apps.py create mode 100644 cosiap_api/modalidades/migrations/__init__.py create mode 100644 cosiap_api/modalidades/models.py create mode 100644 cosiap_api/modalidades/tests.py create mode 100644 cosiap_api/modalidades/urls.py create mode 100644 cosiap_api/modalidades/views.py create mode 100644 cosiap_api/notificaciones/__init__.py create mode 100644 cosiap_api/notificaciones/admin.py create mode 100644 cosiap_api/notificaciones/apps.py create mode 100644 cosiap_api/notificaciones/migrations/__init__.py create mode 100644 cosiap_api/notificaciones/models.py create mode 100644 cosiap_api/notificaciones/tests.py create mode 100644 cosiap_api/notificaciones/urls.py create mode 100644 cosiap_api/notificaciones/views.py create mode 100644 cosiap_api/solicitudes/__init__.py create mode 100644 cosiap_api/solicitudes/admin.py create mode 100644 cosiap_api/solicitudes/apps.py create mode 100644 cosiap_api/solicitudes/migrations/__init__.py create mode 100644 cosiap_api/solicitudes/models.py create mode 100644 cosiap_api/solicitudes/tests.py create mode 100644 cosiap_api/solicitudes/urls.py create mode 100644 cosiap_api/solicitudes/views.py diff --git a/cosiap_api/admin/__init__.py b/cosiap_api/admin/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/cosiap_api/admin/admin.py b/cosiap_api/admin/admin.py new file mode 100644 index 0000000..8c38f3f --- /dev/null +++ b/cosiap_api/admin/admin.py @@ -0,0 +1,3 @@ +from django.contrib import admin + +# Register your models here. diff --git a/cosiap_api/admin/apps.py b/cosiap_api/admin/apps.py new file mode 100644 index 0000000..622f68b --- /dev/null +++ b/cosiap_api/admin/apps.py @@ -0,0 +1,7 @@ +from django.apps import AppConfig + + +class AdminConfig(AppConfig): + default_auto_field = 'django.db.models.BigAutoField' + name = 'admin' + label = 'cosiap_admin' diff --git a/cosiap_api/admin/migrations/__init__.py b/cosiap_api/admin/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/cosiap_api/admin/models.py b/cosiap_api/admin/models.py new file mode 100644 index 0000000..71a8362 --- /dev/null +++ b/cosiap_api/admin/models.py @@ -0,0 +1,3 @@ +from django.db import models + +# Create your models here. diff --git a/cosiap_api/admin/tests.py b/cosiap_api/admin/tests.py new file mode 100644 index 0000000..7ce503c --- /dev/null +++ b/cosiap_api/admin/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/cosiap_api/admin/urls.py b/cosiap_api/admin/urls.py new file mode 100644 index 0000000..7bddda7 --- /dev/null +++ b/cosiap_api/admin/urls.py @@ -0,0 +1,7 @@ +from . import views +from django.urls import path +from django.contrib.auth import views as auth_views + + +app_name = 'admin' +urlpatterns = [] \ No newline at end of file diff --git a/cosiap_api/admin/views.py b/cosiap_api/admin/views.py new file mode 100644 index 0000000..91ea44a --- /dev/null +++ b/cosiap_api/admin/views.py @@ -0,0 +1,3 @@ +from django.shortcuts import render + +# Create your views here. diff --git a/cosiap_api/cosiap_api/settings.py b/cosiap_api/cosiap_api/settings.py index 68e6856..7e3c613 100644 --- a/cosiap_api/cosiap_api/settings.py +++ b/cosiap_api/cosiap_api/settings.py @@ -47,6 +47,13 @@ INSTALLED_APPS = [ 'drf_spectacular', 'corsheaders', 'users', + 'admin', + 'dynamic_formats', + 'dynamic_forms', + 'dynamic_tables', + 'modalidades', + 'notificaciones', + 'solicitudes', ] MIDDLEWARE = [ diff --git a/cosiap_api/cosiap_api/urls.py b/cosiap_api/cosiap_api/urls.py index 7d69109..966aa9f 100644 --- a/cosiap_api/cosiap_api/urls.py +++ b/cosiap_api/cosiap_api/urls.py @@ -23,6 +23,10 @@ from drf_spectacular.views import SpectacularAPIView, SpectacularRedocView, Spec urlpatterns = [ path('admin/', admin.site.urls), path('api/usuarios/',include('users.urls')), + path('administracion/',include('admin.urls')), + path('modalidades/',include('modalidades.urls')), + path('notificaciones/',include('notificaciones.urls')), + path('solicitudes/',include('solicitudes.urls')), # API Doc UI: path('api/schema/', SpectacularAPIView.as_view(), name='schema'), diff --git a/cosiap_api/dynamic_formats/__init__.py b/cosiap_api/dynamic_formats/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/cosiap_api/dynamic_formats/admin.py b/cosiap_api/dynamic_formats/admin.py new file mode 100644 index 0000000..8c38f3f --- /dev/null +++ b/cosiap_api/dynamic_formats/admin.py @@ -0,0 +1,3 @@ +from django.contrib import admin + +# Register your models here. diff --git a/cosiap_api/dynamic_formats/apps.py b/cosiap_api/dynamic_formats/apps.py new file mode 100644 index 0000000..c41dbdf --- /dev/null +++ b/cosiap_api/dynamic_formats/apps.py @@ -0,0 +1,6 @@ +from django.apps import AppConfig + + +class DynamicFormatsConfig(AppConfig): + default_auto_field = 'django.db.models.BigAutoField' + name = 'dynamic_formats' diff --git a/cosiap_api/dynamic_formats/migrations/__init__.py b/cosiap_api/dynamic_formats/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/cosiap_api/dynamic_formats/models.py b/cosiap_api/dynamic_formats/models.py new file mode 100644 index 0000000..71a8362 --- /dev/null +++ b/cosiap_api/dynamic_formats/models.py @@ -0,0 +1,3 @@ +from django.db import models + +# Create your models here. diff --git a/cosiap_api/dynamic_formats/tests.py b/cosiap_api/dynamic_formats/tests.py new file mode 100644 index 0000000..7ce503c --- /dev/null +++ b/cosiap_api/dynamic_formats/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/cosiap_api/dynamic_formats/views.py b/cosiap_api/dynamic_formats/views.py new file mode 100644 index 0000000..91ea44a --- /dev/null +++ b/cosiap_api/dynamic_formats/views.py @@ -0,0 +1,3 @@ +from django.shortcuts import render + +# Create your views here. diff --git a/cosiap_api/dynamic_forms/__init__.py b/cosiap_api/dynamic_forms/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/cosiap_api/dynamic_forms/admin.py b/cosiap_api/dynamic_forms/admin.py new file mode 100644 index 0000000..8c38f3f --- /dev/null +++ b/cosiap_api/dynamic_forms/admin.py @@ -0,0 +1,3 @@ +from django.contrib import admin + +# Register your models here. diff --git a/cosiap_api/dynamic_forms/apps.py b/cosiap_api/dynamic_forms/apps.py new file mode 100644 index 0000000..9d5f527 --- /dev/null +++ b/cosiap_api/dynamic_forms/apps.py @@ -0,0 +1,6 @@ +from django.apps import AppConfig + + +class DynamicFormsConfig(AppConfig): + default_auto_field = 'django.db.models.BigAutoField' + name = 'dynamic_forms' diff --git a/cosiap_api/dynamic_forms/migrations/__init__.py b/cosiap_api/dynamic_forms/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/cosiap_api/dynamic_forms/models.py b/cosiap_api/dynamic_forms/models.py new file mode 100644 index 0000000..71a8362 --- /dev/null +++ b/cosiap_api/dynamic_forms/models.py @@ -0,0 +1,3 @@ +from django.db import models + +# Create your models here. diff --git a/cosiap_api/dynamic_forms/tests.py b/cosiap_api/dynamic_forms/tests.py new file mode 100644 index 0000000..7ce503c --- /dev/null +++ b/cosiap_api/dynamic_forms/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/cosiap_api/dynamic_forms/views.py b/cosiap_api/dynamic_forms/views.py new file mode 100644 index 0000000..91ea44a --- /dev/null +++ b/cosiap_api/dynamic_forms/views.py @@ -0,0 +1,3 @@ +from django.shortcuts import render + +# Create your views here. diff --git a/cosiap_api/dynamic_tables/__init__.py b/cosiap_api/dynamic_tables/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/cosiap_api/dynamic_tables/admin.py b/cosiap_api/dynamic_tables/admin.py new file mode 100644 index 0000000..8c38f3f --- /dev/null +++ b/cosiap_api/dynamic_tables/admin.py @@ -0,0 +1,3 @@ +from django.contrib import admin + +# Register your models here. diff --git a/cosiap_api/dynamic_tables/apps.py b/cosiap_api/dynamic_tables/apps.py new file mode 100644 index 0000000..7cb400e --- /dev/null +++ b/cosiap_api/dynamic_tables/apps.py @@ -0,0 +1,6 @@ +from django.apps import AppConfig + + +class DynamicTablesConfig(AppConfig): + default_auto_field = 'django.db.models.BigAutoField' + name = 'dynamic_tables' diff --git a/cosiap_api/dynamic_tables/migrations/__init__.py b/cosiap_api/dynamic_tables/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/cosiap_api/dynamic_tables/models.py b/cosiap_api/dynamic_tables/models.py new file mode 100644 index 0000000..71a8362 --- /dev/null +++ b/cosiap_api/dynamic_tables/models.py @@ -0,0 +1,3 @@ +from django.db import models + +# Create your models here. diff --git a/cosiap_api/dynamic_tables/tests.py b/cosiap_api/dynamic_tables/tests.py new file mode 100644 index 0000000..7ce503c --- /dev/null +++ b/cosiap_api/dynamic_tables/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/cosiap_api/dynamic_tables/views.py b/cosiap_api/dynamic_tables/views.py new file mode 100644 index 0000000..91ea44a --- /dev/null +++ b/cosiap_api/dynamic_tables/views.py @@ -0,0 +1,3 @@ +from django.shortcuts import render + +# Create your views here. diff --git a/cosiap_api/modalidades/__init__.py b/cosiap_api/modalidades/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/cosiap_api/modalidades/admin.py b/cosiap_api/modalidades/admin.py new file mode 100644 index 0000000..8c38f3f --- /dev/null +++ b/cosiap_api/modalidades/admin.py @@ -0,0 +1,3 @@ +from django.contrib import admin + +# Register your models here. diff --git a/cosiap_api/modalidades/apps.py b/cosiap_api/modalidades/apps.py new file mode 100644 index 0000000..47ef3cb --- /dev/null +++ b/cosiap_api/modalidades/apps.py @@ -0,0 +1,6 @@ +from django.apps import AppConfig + + +class ModalidadesConfig(AppConfig): + default_auto_field = 'django.db.models.BigAutoField' + name = 'modalidades' diff --git a/cosiap_api/modalidades/migrations/__init__.py b/cosiap_api/modalidades/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/cosiap_api/modalidades/models.py b/cosiap_api/modalidades/models.py new file mode 100644 index 0000000..71a8362 --- /dev/null +++ b/cosiap_api/modalidades/models.py @@ -0,0 +1,3 @@ +from django.db import models + +# Create your models here. diff --git a/cosiap_api/modalidades/tests.py b/cosiap_api/modalidades/tests.py new file mode 100644 index 0000000..7ce503c --- /dev/null +++ b/cosiap_api/modalidades/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/cosiap_api/modalidades/urls.py b/cosiap_api/modalidades/urls.py new file mode 100644 index 0000000..b5a1ac3 --- /dev/null +++ b/cosiap_api/modalidades/urls.py @@ -0,0 +1,7 @@ +from . import views +from django.urls import path +from django.contrib.auth import views as auth_views + + +app_name = 'modalidades' +urlpatterns = [] \ No newline at end of file diff --git a/cosiap_api/modalidades/views.py b/cosiap_api/modalidades/views.py new file mode 100644 index 0000000..91ea44a --- /dev/null +++ b/cosiap_api/modalidades/views.py @@ -0,0 +1,3 @@ +from django.shortcuts import render + +# Create your views here. diff --git a/cosiap_api/notificaciones/__init__.py b/cosiap_api/notificaciones/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/cosiap_api/notificaciones/admin.py b/cosiap_api/notificaciones/admin.py new file mode 100644 index 0000000..8c38f3f --- /dev/null +++ b/cosiap_api/notificaciones/admin.py @@ -0,0 +1,3 @@ +from django.contrib import admin + +# Register your models here. diff --git a/cosiap_api/notificaciones/apps.py b/cosiap_api/notificaciones/apps.py new file mode 100644 index 0000000..0155220 --- /dev/null +++ b/cosiap_api/notificaciones/apps.py @@ -0,0 +1,6 @@ +from django.apps import AppConfig + + +class NotificacionesConfig(AppConfig): + default_auto_field = 'django.db.models.BigAutoField' + name = 'notificaciones' diff --git a/cosiap_api/notificaciones/migrations/__init__.py b/cosiap_api/notificaciones/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/cosiap_api/notificaciones/models.py b/cosiap_api/notificaciones/models.py new file mode 100644 index 0000000..71a8362 --- /dev/null +++ b/cosiap_api/notificaciones/models.py @@ -0,0 +1,3 @@ +from django.db import models + +# Create your models here. diff --git a/cosiap_api/notificaciones/tests.py b/cosiap_api/notificaciones/tests.py new file mode 100644 index 0000000..7ce503c --- /dev/null +++ b/cosiap_api/notificaciones/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/cosiap_api/notificaciones/urls.py b/cosiap_api/notificaciones/urls.py new file mode 100644 index 0000000..8a5263a --- /dev/null +++ b/cosiap_api/notificaciones/urls.py @@ -0,0 +1,7 @@ +from . import views +from django.urls import path +from django.contrib.auth import views as auth_views + + +app_name = 'notificaciones' +urlpatterns = [] \ No newline at end of file diff --git a/cosiap_api/notificaciones/views.py b/cosiap_api/notificaciones/views.py new file mode 100644 index 0000000..91ea44a --- /dev/null +++ b/cosiap_api/notificaciones/views.py @@ -0,0 +1,3 @@ +from django.shortcuts import render + +# Create your views here. diff --git a/cosiap_api/solicitudes/__init__.py b/cosiap_api/solicitudes/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/cosiap_api/solicitudes/admin.py b/cosiap_api/solicitudes/admin.py new file mode 100644 index 0000000..8c38f3f --- /dev/null +++ b/cosiap_api/solicitudes/admin.py @@ -0,0 +1,3 @@ +from django.contrib import admin + +# Register your models here. diff --git a/cosiap_api/solicitudes/apps.py b/cosiap_api/solicitudes/apps.py new file mode 100644 index 0000000..6d7b729 --- /dev/null +++ b/cosiap_api/solicitudes/apps.py @@ -0,0 +1,6 @@ +from django.apps import AppConfig + + +class SolicitudesConfig(AppConfig): + default_auto_field = 'django.db.models.BigAutoField' + name = 'solicitudes' diff --git a/cosiap_api/solicitudes/migrations/__init__.py b/cosiap_api/solicitudes/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/cosiap_api/solicitudes/models.py b/cosiap_api/solicitudes/models.py new file mode 100644 index 0000000..71a8362 --- /dev/null +++ b/cosiap_api/solicitudes/models.py @@ -0,0 +1,3 @@ +from django.db import models + +# Create your models here. diff --git a/cosiap_api/solicitudes/tests.py b/cosiap_api/solicitudes/tests.py new file mode 100644 index 0000000..7ce503c --- /dev/null +++ b/cosiap_api/solicitudes/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/cosiap_api/solicitudes/urls.py b/cosiap_api/solicitudes/urls.py new file mode 100644 index 0000000..4a1b414 --- /dev/null +++ b/cosiap_api/solicitudes/urls.py @@ -0,0 +1,7 @@ +from . import views +from django.urls import path +from django.contrib.auth import views as auth_views + + +app_name = 'solicitudes' +urlpatterns = [] \ No newline at end of file diff --git a/cosiap_api/solicitudes/views.py b/cosiap_api/solicitudes/views.py new file mode 100644 index 0000000..91ea44a --- /dev/null +++ b/cosiap_api/solicitudes/views.py @@ -0,0 +1,3 @@ +from django.shortcuts import render + +# Create your views here. diff --git a/cosiap_api/users/urls.py b/cosiap_api/users/urls.py index f3e1c61..d73a4e6 100644 --- a/cosiap_api/users/urls.py +++ b/cosiap_api/users/urls.py @@ -1,18 +1,3 @@ -"""becas_cozcyt URL Configuration - -The `urlpatterns` list routes URLs to views. For more information please see: - https://docs.djangoproject.com/en/4.1/topics/http/urls/ -Examples: -Function views - 1. Add an import: from my_app import views - 2. Add a URL to urlpatterns: path('', views.home, name='home') -Class-based views - 1. Add an import: from other_app.views import Home - 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') -Including another URLconf - 1. Import the include() function: from django.urls import include, path - 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) -""" from . import views from django.urls import path from django.contrib.auth import views as auth_views diff --git a/cosiap_api/users/views.py b/cosiap_api/users/views.py index 7c2a150..d5b7da6 100644 --- a/cosiap_api/users/views.py +++ b/cosiap_api/users/views.py @@ -40,7 +40,7 @@ class CustomTokenObtainPairView(TokenObtainPairView): # Eliminar el refresh token de la respuesta JSON del response.data['refresh'] # Agregar mensaje de éxito - response.data['message'] = {'succes':'Login exitoso'} + response.data['message'] = {'success':'Login exitoso'} return response -- GitLab From 4769315ffe7bf7c89e52aaf9969dab2eadbfe65a Mon Sep 17 00:00:00 2001 From: RafaUC Date: Fri, 5 Jul 2024 14:31:51 -0600 Subject: [PATCH 2/3] creacion de los demas modulos base 2 --- .../{admin => administracion}/__init__.py | 0 cosiap_api/{admin => administracion}/admin.py | 0 cosiap_api/{admin => administracion}/apps.py | 3 +-- .../migrations/__init__.py | 0 .../{admin => administracion}/models.py | 0 cosiap_api/{admin => administracion}/tests.py | 0 cosiap_api/{admin => administracion}/urls.py | 2 +- cosiap_api/{admin => administracion}/views.py | 0 cosiap_api/cosiap_api/settings.py | 2 +- cosiap_api/cosiap_api/urls.py | 8 ++++---- ...ts_forms_tables_modalidades_solicitudes.py | 19 +++++++++++++++++++ 11 files changed, 26 insertions(+), 8 deletions(-) rename cosiap_api/{admin => administracion}/__init__.py (100%) rename cosiap_api/{admin => administracion}/admin.py (100%) rename cosiap_api/{admin => administracion}/apps.py (72%) rename cosiap_api/{admin => administracion}/migrations/__init__.py (100%) rename cosiap_api/{admin => administracion}/models.py (100%) rename cosiap_api/{admin => administracion}/tests.py (100%) rename cosiap_api/{admin => administracion}/urls.py (80%) rename cosiap_api/{admin => administracion}/views.py (100%) create mode 100644 cosiap_api/users/migrations/0010_creacion_modulos_admin_formats_forms_tables_modalidades_solicitudes.py diff --git a/cosiap_api/admin/__init__.py b/cosiap_api/administracion/__init__.py similarity index 100% rename from cosiap_api/admin/__init__.py rename to cosiap_api/administracion/__init__.py diff --git a/cosiap_api/admin/admin.py b/cosiap_api/administracion/admin.py similarity index 100% rename from cosiap_api/admin/admin.py rename to cosiap_api/administracion/admin.py diff --git a/cosiap_api/admin/apps.py b/cosiap_api/administracion/apps.py similarity index 72% rename from cosiap_api/admin/apps.py rename to cosiap_api/administracion/apps.py index 622f68b..7b463d7 100644 --- a/cosiap_api/admin/apps.py +++ b/cosiap_api/administracion/apps.py @@ -3,5 +3,4 @@ from django.apps import AppConfig class AdminConfig(AppConfig): default_auto_field = 'django.db.models.BigAutoField' - name = 'admin' - label = 'cosiap_admin' + name = 'administracion' diff --git a/cosiap_api/admin/migrations/__init__.py b/cosiap_api/administracion/migrations/__init__.py similarity index 100% rename from cosiap_api/admin/migrations/__init__.py rename to cosiap_api/administracion/migrations/__init__.py diff --git a/cosiap_api/admin/models.py b/cosiap_api/administracion/models.py similarity index 100% rename from cosiap_api/admin/models.py rename to cosiap_api/administracion/models.py diff --git a/cosiap_api/admin/tests.py b/cosiap_api/administracion/tests.py similarity index 100% rename from cosiap_api/admin/tests.py rename to cosiap_api/administracion/tests.py diff --git a/cosiap_api/admin/urls.py b/cosiap_api/administracion/urls.py similarity index 80% rename from cosiap_api/admin/urls.py rename to cosiap_api/administracion/urls.py index 7bddda7..3a22da4 100644 --- a/cosiap_api/admin/urls.py +++ b/cosiap_api/administracion/urls.py @@ -3,5 +3,5 @@ from django.urls import path from django.contrib.auth import views as auth_views -app_name = 'admin' +app_name = 'administracion' urlpatterns = [] \ No newline at end of file diff --git a/cosiap_api/admin/views.py b/cosiap_api/administracion/views.py similarity index 100% rename from cosiap_api/admin/views.py rename to cosiap_api/administracion/views.py diff --git a/cosiap_api/cosiap_api/settings.py b/cosiap_api/cosiap_api/settings.py index 7e3c613..aa384da 100644 --- a/cosiap_api/cosiap_api/settings.py +++ b/cosiap_api/cosiap_api/settings.py @@ -47,7 +47,7 @@ INSTALLED_APPS = [ 'drf_spectacular', 'corsheaders', 'users', - 'admin', + 'administracion', 'dynamic_formats', 'dynamic_forms', 'dynamic_tables', diff --git a/cosiap_api/cosiap_api/urls.py b/cosiap_api/cosiap_api/urls.py index 966aa9f..d9305b7 100644 --- a/cosiap_api/cosiap_api/urls.py +++ b/cosiap_api/cosiap_api/urls.py @@ -23,10 +23,10 @@ from drf_spectacular.views import SpectacularAPIView, SpectacularRedocView, Spec urlpatterns = [ path('admin/', admin.site.urls), path('api/usuarios/',include('users.urls')), - path('administracion/',include('admin.urls')), - path('modalidades/',include('modalidades.urls')), - path('notificaciones/',include('notificaciones.urls')), - path('solicitudes/',include('solicitudes.urls')), + path('api/administracion/',include('administracion.urls')), + path('api/modalidades/',include('modalidades.urls')), + path('api/notificaciones/',include('notificaciones.urls')), + path('api/solicitudes/',include('solicitudes.urls')), # API Doc UI: path('api/schema/', SpectacularAPIView.as_view(), name='schema'), diff --git a/cosiap_api/users/migrations/0010_creacion_modulos_admin_formats_forms_tables_modalidades_solicitudes.py b/cosiap_api/users/migrations/0010_creacion_modulos_admin_formats_forms_tables_modalidades_solicitudes.py new file mode 100644 index 0000000..a3de9c8 --- /dev/null +++ b/cosiap_api/users/migrations/0010_creacion_modulos_admin_formats_forms_tables_modalidades_solicitudes.py @@ -0,0 +1,19 @@ +# Generated by Django 5.0.6 on 2024-07-05 20:27 + +import common.nombres_archivos +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('users', '0009_solicitante_campos_no_vacios'), + ] + + operations = [ + migrations.AlterField( + model_name='solicitante', + name='INE', + field=models.FileField(null=True, upload_to=common.nombres_archivos.nombre_archivo_ine, verbose_name='INE'), + ), + ] -- GitLab From 444b7c8ff56e2cdc9a3e89fcd46c412dc3afb1fe Mon Sep 17 00:00:00 2001 From: RafaUC Date: Fri, 5 Jul 2024 14:52:05 -0600 Subject: [PATCH 3/3] creado La clase Mensaje para agregar mensajes en las responses --- cosiap_api/notificaciones/Mensajes.py | 73 +++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 cosiap_api/notificaciones/Mensajes.py diff --git a/cosiap_api/notificaciones/Mensajes.py b/cosiap_api/notificaciones/Mensajes.py new file mode 100644 index 0000000..39289bd --- /dev/null +++ b/cosiap_api/notificaciones/Mensajes.py @@ -0,0 +1,73 @@ +class Mensaje: + """ + Clase estática para manejar mensajes de distintos tipos en un diccionario de respuesta. + Importacion: from notificaciones.mensajes import Mensaje as mensaje + + Métodos estáticos: + - success(response, message): Añade un mensaje de éxito. + - warning(response, message): Añade un mensaje de advertencia. + - error(response, message): Añade un mensaje de error. + - info(response, message): Añade un mensaje informativo. + """ + + @staticmethod + def _add_message(response, tag, message): + """ + Añade un mensaje al diccionario de respuesta bajo el tipo especificado. + + Parámetros: + - response (dict): El diccionario de respuesta donde se añadirán los mensajes. + - tag (str): El tipo de mensaje ('success', 'warning', 'error', 'info'). + - message (str): El mensaje a añadir. + """ + if 'data' not in response: + response['data'] = {} + if 'message' not in response['data']: + response['data']['message'] = {} + if tag not in response['data']['message']: + response['data']['message'][tag] = [] + response['data']['message'][tag].append(message) + + @staticmethod + def success(response, message): + """ + Añade un mensaje de éxito al diccionario de respuesta. + + Parámetros: + - response (dict): El diccionario de respuesta. + - message (str): El mensaje de éxito a añadir. + """ + Mensaje._add_message(response, 'success', message) + + @staticmethod + def warning(response, message): + """ + Añade un mensaje de advertencia al diccionario de respuesta. + + Parámetros: + - response (dict): El diccionario de respuesta. + - message (str): El mensaje de advertencia a añadir. + """ + Mensaje._add_message(response, 'warning', message) + + @staticmethod + def error(response, message): + """ + Añade un mensaje de error al diccionario de respuesta. + + Parámetros: + - response (dict): El diccionario de respuesta. + - message (str): El mensaje de error a añadir. + """ + Mensaje._add_message(response, 'error', message) + + @staticmethod + def info(response, message): + """ + Añade un mensaje informativo al diccionario de respuesta. + + Parámetros: + - response (dict): El diccionario de respuesta. + - message (str): El mensaje informativo a añadir. + """ + Mensaje._add_message(response, 'info', message) \ No newline at end of file -- GitLab