componentsDjangoType 2.0.14__tar.gz → 2.0.16__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {componentsdjangotype-2.0.14/componentsDjangoType.egg-info → componentsdjangotype-2.0.16}/PKG-INFO +1 -1
- {componentsdjangotype-2.0.14 → componentsdjangotype-2.0.16}/componentsDjangoType/management/commands/createApp.py +0 -5
- {componentsdjangotype-2.0.14 → componentsdjangotype-2.0.16/componentsDjangoType.egg-info}/PKG-INFO +1 -1
- {componentsdjangotype-2.0.14 → componentsdjangotype-2.0.16}/services/authenticator_configurator.py +56 -49
- {componentsdjangotype-2.0.14 → componentsdjangotype-2.0.16}/setup.py +1 -1
- {componentsdjangotype-2.0.14 → componentsdjangotype-2.0.16}/LICENSE +0 -0
- {componentsdjangotype-2.0.14 → componentsdjangotype-2.0.16}/MANIFEST.in +0 -0
- {componentsdjangotype-2.0.14 → componentsdjangotype-2.0.16}/README.md +0 -0
- {componentsdjangotype-2.0.14 → componentsdjangotype-2.0.16}/componentsDjangoType/__init__.py +0 -0
- {componentsdjangotype-2.0.14 → componentsdjangotype-2.0.16}/componentsDjangoType/management/__init__.py +0 -0
- {componentsdjangotype-2.0.14 → componentsdjangotype-2.0.16}/componentsDjangoType/management/commands/__init__.py +0 -0
- {componentsdjangotype-2.0.14 → componentsdjangotype-2.0.16}/componentsDjangoType/management/commands/createcomponent.py +0 -0
- {componentsdjangotype-2.0.14 → componentsdjangotype-2.0.16}/componentsDjangoType.egg-info/SOURCES.txt +0 -0
- {componentsdjangotype-2.0.14 → componentsdjangotype-2.0.16}/componentsDjangoType.egg-info/dependency_links.txt +0 -0
- {componentsdjangotype-2.0.14 → componentsdjangotype-2.0.16}/componentsDjangoType.egg-info/requires.txt +0 -0
- {componentsdjangotype-2.0.14 → componentsdjangotype-2.0.16}/componentsDjangoType.egg-info/top_level.txt +0 -0
- {componentsdjangotype-2.0.14 → componentsdjangotype-2.0.16}/services/__init__.py +0 -0
- {componentsdjangotype-2.0.14 → componentsdjangotype-2.0.16}/services/authentication/__init__.py +0 -0
- {componentsdjangotype-2.0.14 → componentsdjangotype-2.0.16}/services/authentication/auth.py +0 -0
- {componentsdjangotype-2.0.14 → componentsdjangotype-2.0.16}/setup.cfg +0 -0
@@ -53,24 +53,19 @@ from Home.services.authentication import Authentication
|
|
53
53
|
def home(request):
|
54
54
|
return render(request, 'home.html')
|
55
55
|
|
56
|
-
|
57
56
|
def signup(request):
|
58
57
|
return Authentication.get_signup(request)
|
59
58
|
|
60
|
-
|
61
59
|
def signout(request):
|
62
60
|
return Authentication.get_signout(request)
|
63
61
|
|
64
|
-
|
65
62
|
def signing(request):
|
66
63
|
return Authentication.get_signing(request)
|
67
64
|
|
68
|
-
|
69
65
|
@login_required
|
70
66
|
def logged(request):
|
71
67
|
return Authentication.get_logged(request)
|
72
68
|
|
73
|
-
|
74
69
|
def custom_dispatch(request, *args, **kwargs):
|
75
70
|
return Authentication.dispatch(request, *args, **kwargs)
|
76
71
|
"""
|
{componentsdjangotype-2.0.14 → componentsdjangotype-2.0.16}/services/authenticator_configurator.py
RENAMED
@@ -2,6 +2,7 @@ import os
|
|
2
2
|
import ast
|
3
3
|
from django.core.management.base import BaseCommand
|
4
4
|
from django.core.management import call_command
|
5
|
+
from services.authentication import auth
|
5
6
|
|
6
7
|
class DjangoProjectManager:
|
7
8
|
def __init__(self, app_name, project_name):
|
@@ -46,7 +47,7 @@ class DjangoProjectManager:
|
|
46
47
|
# Comprobar si la aplicación no está ya en INSTALLED_APPS
|
47
48
|
if f"'{self.app_name}'" not in installed_apps_content:
|
48
49
|
# Insertar la aplicación dentro de la lista
|
49
|
-
new_installed_apps = installed_apps_content[:-1] + f"'{self.app_name}',\n]"
|
50
|
+
new_installed_apps = installed_apps_content[:-1] + f" '{self.app_name}',\n]"
|
50
51
|
|
51
52
|
# Reemplazar el bloque INSTALLED_APPS con la nueva lista
|
52
53
|
new_settings_content = settings_content[:installed_apps_start] + new_installed_apps + settings_content[installed_apps_end:]
|
@@ -62,67 +63,73 @@ class DjangoProjectManager:
|
|
62
63
|
print(f"'{self.app_name}' ya está en INSTALLED_APPS.")
|
63
64
|
|
64
65
|
def create_urls(self, stdout):
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
if not os.path.exists(urls_path):
|
72
|
-
# Si el archivo no existe, lo creamos con un contenido básico
|
73
|
-
stdout.write(f"Creando el archivo '{urls_path}'...")
|
74
|
-
with open(urls_path, 'w') as f:
|
75
|
-
f.write("""from django.contrib import admin
|
76
|
-
from django.urls import path, include\n\n
|
66
|
+
"""
|
67
|
+
Modifica el archivo 'urls.py' del proyecto principal para agregar rutas si no están presentes.
|
68
|
+
Si el archivo no existe, lo crea con un contenido básico.
|
69
|
+
"""
|
70
|
+
project_urls_path = os.path.join(self.project_name, 'urls.py')
|
77
71
|
|
72
|
+
if not os.path.exists(project_urls_path):
|
73
|
+
stdout.write(f"Creando el archivo '{project_urls_path}'...")
|
74
|
+
with open(project_urls_path, 'w') as f:
|
75
|
+
f.write("""from django.contrib import admin
|
76
|
+
from django.urls import path, include\n\n
|
78
77
|
urlpatterns = [
|
79
78
|
path('admin/', admin.site.urls),
|
80
|
-
path('', include(
|
79
|
+
path('', include('home.urls')),
|
81
80
|
# Añade tus rutas aquí
|
82
81
|
]\n""")
|
82
|
+
else:
|
83
|
+
# Si el archivo ya existe, lo leemos y agregamos nuevas rutas
|
84
|
+
stdout.write(f"El archivo '{project_urls_path}' ya existe. Verificando contenido...")
|
85
|
+
|
86
|
+
with open(project_urls_path, 'r') as f:
|
87
|
+
urls_content = f.read()
|
88
|
+
|
89
|
+
updated = False
|
90
|
+
|
91
|
+
# Verificar si 'urlpatterns' existe
|
92
|
+
if 'urlpatterns = [' not in urls_content:
|
93
|
+
stdout.write(f"No se encontró 'urlpatterns'. Creando la lista de rutas desde cero.")
|
94
|
+
urls_content += "\nurlpatterns = [\n path('admin/', admin.site.urls),\n]\n"
|
95
|
+
updated = True
|
96
|
+
|
97
|
+
# Agregar 'include' si no está presente
|
98
|
+
if 'include' not in urls_content:
|
99
|
+
stdout.write("Agregando 'include' a los imports.")
|
100
|
+
urls_content = urls_content.replace(
|
101
|
+
"from django.urls import path",
|
102
|
+
"from django.urls import path, include"
|
103
|
+
)
|
104
|
+
updated = True
|
105
|
+
|
106
|
+
# Agregar la ruta para 'home.urls' si no existe
|
107
|
+
if "include('home.urls')" not in urls_content:
|
108
|
+
stdout.write("Agregando ruta para 'home.urls'.")
|
109
|
+
urls_content = urls_content.replace(
|
110
|
+
"urlpatterns = [",
|
111
|
+
"urlpatterns = [\n path('', include('home.urls')),\n"
|
112
|
+
)
|
113
|
+
updated = True
|
114
|
+
|
115
|
+
# Escribir de nuevo el archivo si hubo cambios
|
116
|
+
if updated:
|
117
|
+
with open(project_urls_path, 'w') as f:
|
118
|
+
f.write(urls_content)
|
119
|
+
stdout.write(f"El archivo '{project_urls_path}' fue actualizado.")
|
83
120
|
else:
|
84
|
-
|
85
|
-
stdout.write(f"El archivo '{urls_path}' ya existe. Agregando nuevas rutas...")
|
86
|
-
|
87
|
-
with open(urls_path, 'r') as f:
|
88
|
-
urls_content = f.read()
|
89
|
-
|
90
|
-
# Verificar si ya existe una lista 'urlpatterns'
|
91
|
-
if 'urlpatterns = [' in urls_content:
|
92
|
-
# Verificar si 'path' ya está en la lista
|
93
|
-
if 'path' not in urls_content:
|
94
|
-
urls_content = urls_content.replace(
|
95
|
-
"urlpatterns = [",
|
96
|
-
"urlpatterns = [\n path('admin/', admin.site.urls),"
|
97
|
-
)
|
98
|
-
# Verificar si 'include' ya está presente en urlpatterns
|
99
|
-
if 'include' not in urls_content:
|
100
|
-
urls_content = urls_content.replace(
|
101
|
-
"]\n",
|
102
|
-
" path('', include('home.urls')),\n # Otras rutas aquí\n]"
|
103
|
-
)
|
104
|
-
else:
|
105
|
-
# Si ya contiene 'include', solo agregamos una nueva ruta
|
106
|
-
urls_content = urls_content.replace(
|
107
|
-
"]\n",
|
108
|
-
" path('', include('home.urls')),\n # Otras rutas aquí\n]"
|
109
|
-
)
|
110
|
-
|
111
|
-
# Escribir el contenido actualizado en el archivo
|
112
|
-
with open(urls_path, 'w') as f:
|
113
|
-
f.write(urls_content)
|
114
|
-
stdout.write(f"Nuevas rutas fueron agregadas a '{urls_path}'.")
|
115
|
-
else:
|
116
|
-
stdout.write(f"No se encontró la lista 'urlpatterns' en '{urls_path}'.")
|
121
|
+
stdout.write(f"No fue necesario realizar cambios en '{project_urls_path}'.")
|
117
122
|
|
118
123
|
def creation_auth(self, stdout):
|
119
124
|
services_dir = os.path.join(self.app_name, 'services')
|
120
125
|
authentication_dir = os.path.join(services_dir, 'authentication')
|
121
|
-
os.makedirs(authentication_dir, exist_ok=True)
|
126
|
+
os.makedirs(authentication_dir, exist_ok=True)
|
122
127
|
|
128
|
+
# Ruta para el nuevo archivo a crear
|
123
129
|
authentication_path = os.path.join(authentication_dir, 'authentication.py')
|
124
130
|
|
125
|
-
|
131
|
+
# Usar el atributo __file__ del módulo 'auth' para obtener la ruta del archivo fuente
|
132
|
+
auth_source_path = os.path.abspath(auth.__file__)
|
126
133
|
|
127
134
|
if not os.path.exists(auth_source_path):
|
128
135
|
stdout.write(f"El archivo fuente '{auth_source_path}' no existe. Verifica la instalación del paquete.")
|
File without changes
|
File without changes
|
File without changes
|
{componentsdjangotype-2.0.14 → componentsdjangotype-2.0.16}/componentsDjangoType/__init__.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{componentsdjangotype-2.0.14 → componentsdjangotype-2.0.16}/services/authentication/__init__.py
RENAMED
File without changes
|
File without changes
|
File without changes
|