componentsDjangoType 2.0.23__tar.gz → 2.0.24__tar.gz

Sign up to get free protection for your applications and to get access to all the features.
Files changed (23) hide show
  1. {componentsdjangotype-2.0.23/componentsDjangoType.egg-info → componentsdjangotype-2.0.24}/PKG-INFO +1 -1
  2. {componentsdjangotype-2.0.23 → componentsdjangotype-2.0.24/componentsDjangoType.egg-info}/PKG-INFO +1 -1
  3. {componentsdjangotype-2.0.23 → componentsdjangotype-2.0.24}/services/authenticator_configurator.py +44 -57
  4. {componentsdjangotype-2.0.23 → componentsdjangotype-2.0.24}/setup.py +1 -1
  5. {componentsdjangotype-2.0.23 → componentsdjangotype-2.0.24}/LICENSE +0 -0
  6. {componentsdjangotype-2.0.23 → componentsdjangotype-2.0.24}/MANIFEST.in +0 -0
  7. {componentsdjangotype-2.0.23 → componentsdjangotype-2.0.24}/README.md +0 -0
  8. {componentsdjangotype-2.0.23 → componentsdjangotype-2.0.24}/componentsDjangoType/__init__.py +0 -0
  9. {componentsdjangotype-2.0.23 → componentsdjangotype-2.0.24}/componentsDjangoType/management/__init__.py +0 -0
  10. {componentsdjangotype-2.0.23 → componentsdjangotype-2.0.24}/componentsDjangoType/management/commands/__init__.py +0 -0
  11. {componentsdjangotype-2.0.23 → componentsdjangotype-2.0.24}/componentsDjangoType/management/commands/createApp.py +0 -0
  12. {componentsdjangotype-2.0.23 → componentsdjangotype-2.0.24}/componentsDjangoType/management/commands/createcomponent.py +0 -0
  13. {componentsdjangotype-2.0.23 → componentsdjangotype-2.0.24}/componentsDjangoType.egg-info/SOURCES.txt +0 -0
  14. {componentsdjangotype-2.0.23 → componentsdjangotype-2.0.24}/componentsDjangoType.egg-info/dependency_links.txt +0 -0
  15. {componentsdjangotype-2.0.23 → componentsdjangotype-2.0.24}/componentsDjangoType.egg-info/requires.txt +0 -0
  16. {componentsdjangotype-2.0.23 → componentsdjangotype-2.0.24}/componentsDjangoType.egg-info/top_level.txt +0 -0
  17. {componentsdjangotype-2.0.23 → componentsdjangotype-2.0.24}/services/__init__.py +0 -0
  18. {componentsdjangotype-2.0.23 → componentsdjangotype-2.0.24}/services/authentication/__init__.py +0 -0
  19. {componentsdjangotype-2.0.23 → componentsdjangotype-2.0.24}/services/authentication/auth.py +0 -0
  20. {componentsdjangotype-2.0.23 → componentsdjangotype-2.0.24}/services/core/__init__.py +0 -0
  21. {componentsdjangotype-2.0.23 → componentsdjangotype-2.0.24}/services/core/urls_page.py +0 -0
  22. {componentsdjangotype-2.0.23 → componentsdjangotype-2.0.24}/services/core/views_page.py +0 -0
  23. {componentsdjangotype-2.0.23 → componentsdjangotype-2.0.24}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: componentsDjangoType
3
- Version: 2.0.23
3
+ Version: 2.0.24
4
4
  Summary: Comandos para crear archivos html, css y js
5
5
  Home-page: https://github.com/jose-CR/componentsDjangoType
6
6
  Author: Alejandro
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: componentsDjangoType
3
- Version: 2.0.23
3
+ Version: 2.0.24
4
4
  Summary: Comandos para crear archivos html, css y js
5
5
  Home-page: https://github.com/jose-CR/componentsDjangoType
6
6
  Author: Alejandro
@@ -3,7 +3,6 @@ import ast
3
3
  from django.core.management.base import BaseCommand
4
4
  from django.core.management import call_command
5
5
  from services.authentication import auth
6
- from services.core import views_page, urls_page
7
6
 
8
7
  class DjangoProjectManager:
9
8
  def __init__(self, app_name, project_name):
@@ -118,73 +117,61 @@ path('', include('home.urls'))
118
117
  stdout.write(f"No fue necesario realizar cambios en '{project_urls_path}'.\n")
119
118
 
120
119
  def creation_auth(self, stdout):
121
- services_dir = os.path.join(self.app_name, 'services')
122
- authentication_dir = os.path.join(services_dir, 'authentication')
123
- os.makedirs(authentication_dir, exist_ok=True)
120
+ home_dir = 'Home' # Nombre de la aplicación Home
121
+ views_path = os.path.join(home_dir, 'views.py')
122
+ urls_path = os.path.join(home_dir, 'urls.py')
124
123
 
125
- # Ruta para el nuevo archivo a crear
126
- authentication_path = os.path.join(authentication_dir, 'authentication.py')
124
+ # Crear el directorio de la aplicación Home si no existe
125
+ if not os.path.exists(home_dir):
126
+ os.makedirs(home_dir) # Crear el directorio para la aplicación Home
127
+ stdout.write(f"Directorio '{home_dir}' creado.\n")
128
+ else:
129
+ stdout.write(f"El directorio '{home_dir}' ya existe.\n")
127
130
 
128
- # Usar el atributo __file__ del módulo 'auth' para obtener la ruta del archivo fuente
129
- auth_source_path = os.path.abspath(auth.__file__)
131
+ # Verificar si views.py existe y crearlo si no existe
132
+ if not os.path.exists(views_path):
133
+ views_code = '''from django.shortcuts import render
134
+ from Home.services.authentication import Authentication
130
135
 
131
- if not os.path.exists(auth_source_path):
132
- stdout.write(f"El archivo fuente '{auth_source_path}' no existe. Verifica la instalación del paquete.")
133
- return
136
+ def home(request):
137
+ return render(request, 'home.html')
134
138
 
135
- if not os.path.exists(authentication_path):
136
- stdout.write(f"Creando el archivo '{authentication_path}'...")
139
+ def signup(request):
140
+ return Authentication.get_signup(request)
137
141
 
138
- # Leer el contenido de 'auth.py' del paquete
139
- try:
140
- with open(auth_source_path, 'r') as source_file:
141
- auth_code = source_file.read()
142
+ def signout(request):
143
+ return Authentication.get_signout(request)
142
144
 
143
- # Escribir el contenido en el nuevo archivo 'authentication.py'
144
- with open(authentication_path, 'w') as dest_file:
145
- dest_file.write(auth_code)
145
+ def signing(request):
146
+ return Authentication.get_signing(request)
146
147
 
147
- stdout.write(f"El archivo '{authentication_path}' fue creado y el código fue copiado.")
148
- except Exception as e:
149
- stdout.write(f"Error al copiar el archivo: {e}")
148
+ def logged(request):
149
+ return Authentication.get_logged(request)
150
+ '''
151
+ with open(views_path, 'w') as views_file:
152
+ views_file.write(views_code)
153
+ stdout.write(f"El archivo '{views_path}' ha sido creado.\n")
150
154
  else:
151
- stdout.write(f"El archivo '{authentication_path}' ya existe.")
155
+ stdout.write(f"El archivo '{views_path}' ya existe.\n")
152
156
 
153
- def create_views_urls(self, stdout):
154
- home_dir = 'Home'
155
- views_path = os.path.join(home_dir, 'views.py')
156
- urls_path = os.path.join(home_dir, 'urls.py')
157
-
158
- # Crear el directorio si no existe
159
- os.makedirs(home_dir, exist_ok=True)
157
+ # Verificar si urls.py existe y crearlo si no existe
158
+ if not os.path.exists(urls_path):
159
+ urls_code = '''from django.urls import path
160
+ from . import views
160
161
 
161
- # Verificar y crear views.py
162
- views_source_path = os.path.abspath(views_page.__file__) # Validar existencia
163
- if not os.path.exists(views_source_path):
164
- stdout.write(f"El archivo fuente '{views_source_path}' no existe.\n")
165
- else:
166
- self.create_file(views_source_path, views_path, stdout)
167
-
168
- # Verificar y crear urls.py
169
- urls_source_path = os.path.abspath(urls_page.__file__) # Validar existencia
170
- if not os.path.exists(urls_source_path):
171
- stdout.write(f"El archivo fuente '{urls_source_path}' no existe.\n")
162
+ urlpatterns = [
163
+ path("", views.home, name='home'),
164
+ path("signup", views.signup, name='signup'),
165
+ path("login", views.signing, name='login'),
166
+ path("logout", views.signout, name='logout'),
167
+ path("logged", views.logged, name='logged'),
168
+ ]
169
+ '''
170
+ with open(urls_path, 'w') as urls_file:
171
+ urls_file.write(urls_code)
172
+ stdout.write(f"El archivo '{urls_path}' ha sido creado.\n")
172
173
  else:
173
- self.create_file(urls_source_path, urls_path, stdout)
174
-
175
- def create_file(self, source_path, dest_path, stdout):
176
- try:
177
- # Leer el contenido del archivo fuente
178
- with open(source_path, 'r') as source_file:
179
- code = source_file.read()
180
-
181
- # Crear y escribir el contenido en el archivo de destino
182
- with open(dest_path, 'w') as dest_file:
183
- dest_file.write(code)
184
-
185
- stdout.write(f"El archivo '{dest_path}' fue creado y el código fue copiado.\n")
186
- except Exception as e:
187
- stdout.write(f"Error al copiar el archivo: {e}\n")
174
+ stdout.write(f"El archivo '{urls_path}' ya existe.\n")
188
175
 
189
176
 
190
177
 
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
4
  name='componentsDjangoType',
5
- version='2.0.23',
5
+ version='2.0.24',
6
6
  packages=find_packages(),
7
7
  include_package_data=True,
8
8
  license='MIT',