componentsDjangoType 2.0.15__tar.gz → 2.0.17__tar.gz

Sign up to get free protection for your applications and to get access to all the features.
Files changed (20) hide show
  1. {componentsdjangotype-2.0.15/componentsDjangoType.egg-info → componentsdjangotype-2.0.17}/PKG-INFO +1 -1
  2. {componentsdjangotype-2.0.15 → componentsdjangotype-2.0.17}/componentsDjangoType/management/commands/createApp.py +0 -5
  3. {componentsdjangotype-2.0.15 → componentsdjangotype-2.0.17/componentsDjangoType.egg-info}/PKG-INFO +1 -1
  4. {componentsdjangotype-2.0.15 → componentsdjangotype-2.0.17}/services/authenticator_configurator.py +54 -49
  5. {componentsdjangotype-2.0.15 → componentsdjangotype-2.0.17}/setup.py +1 -1
  6. {componentsdjangotype-2.0.15 → componentsdjangotype-2.0.17}/LICENSE +0 -0
  7. {componentsdjangotype-2.0.15 → componentsdjangotype-2.0.17}/MANIFEST.in +0 -0
  8. {componentsdjangotype-2.0.15 → componentsdjangotype-2.0.17}/README.md +0 -0
  9. {componentsdjangotype-2.0.15 → componentsdjangotype-2.0.17}/componentsDjangoType/__init__.py +0 -0
  10. {componentsdjangotype-2.0.15 → componentsdjangotype-2.0.17}/componentsDjangoType/management/__init__.py +0 -0
  11. {componentsdjangotype-2.0.15 → componentsdjangotype-2.0.17}/componentsDjangoType/management/commands/__init__.py +0 -0
  12. {componentsdjangotype-2.0.15 → componentsdjangotype-2.0.17}/componentsDjangoType/management/commands/createcomponent.py +0 -0
  13. {componentsdjangotype-2.0.15 → componentsdjangotype-2.0.17}/componentsDjangoType.egg-info/SOURCES.txt +0 -0
  14. {componentsdjangotype-2.0.15 → componentsdjangotype-2.0.17}/componentsDjangoType.egg-info/dependency_links.txt +0 -0
  15. {componentsdjangotype-2.0.15 → componentsdjangotype-2.0.17}/componentsDjangoType.egg-info/requires.txt +0 -0
  16. {componentsdjangotype-2.0.15 → componentsdjangotype-2.0.17}/componentsDjangoType.egg-info/top_level.txt +0 -0
  17. {componentsdjangotype-2.0.15 → componentsdjangotype-2.0.17}/services/__init__.py +0 -0
  18. {componentsdjangotype-2.0.15 → componentsdjangotype-2.0.17}/services/authentication/__init__.py +0 -0
  19. {componentsdjangotype-2.0.15 → componentsdjangotype-2.0.17}/services/authentication/auth.py +0 -0
  20. {componentsdjangotype-2.0.15 → componentsdjangotype-2.0.17}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: componentsDjangoType
3
- Version: 2.0.15
3
+ Version: 2.0.17
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
@@ -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
  """
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: componentsDjangoType
3
- Version: 2.0.15
3
+ Version: 2.0.17
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
@@ -47,7 +47,7 @@ class DjangoProjectManager:
47
47
  # Comprobar si la aplicación no está ya en INSTALLED_APPS
48
48
  if f"'{self.app_name}'" not in installed_apps_content:
49
49
  # Insertar la aplicación dentro de la lista
50
- 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]"
51
51
 
52
52
  # Reemplazar el bloque INSTALLED_APPS con la nueva lista
53
53
  new_settings_content = settings_content[:installed_apps_start] + new_installed_apps + settings_content[installed_apps_end:]
@@ -63,58 +63,63 @@ class DjangoProjectManager:
63
63
  print(f"'{self.app_name}' ya está en INSTALLED_APPS.")
64
64
 
65
65
  def create_urls(self, stdout):
66
- """
67
- Crea el archivo 'urls.py' si no existe, y si existe, agrega nuevas rutas
68
- sin sobrescribir el contenido existente.
69
- """
70
- urls_path = os.path.join(self.app_name, 'urls.py')
71
-
72
- if not os.path.exists(urls_path):
73
- # Si el archivo no existe, lo creamos con un contenido básico
74
- stdout.write(f"Creando el archivo '{urls_path}'...")
75
- with open(urls_path, 'w') as f:
76
- f.write("""from django.contrib import admin
77
- 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')
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 # Asegúrate de incluir include
78
77
 
79
78
  urlpatterns = [
80
- path('admin/', admin.site.urls),
81
- path('', include(Home.urls)),
79
+ path('admin/', admin.site.urls),
80
+ path('', include('home.urls'))
82
81
  # Añade tus rutas aquí
83
- ]\n""")
82
+ ]
83
+ """)
84
+ else:
85
+ # Leer el contenido actual del archivo
86
+ stdout.write(f"El archivo '{project_urls_path}' ya existe. Verificando contenido...")
87
+ with open(project_urls_path, 'r') as f:
88
+ urls_content = f.read()
89
+
90
+ updated = False
91
+
92
+ # Verificar o agregar el import de 'include'
93
+ if 'include' not in urls_content:
94
+ stdout.write("Agregando 'include' a los imports.")
95
+ urls_content = urls_content.replace(
96
+ "from django.urls import path",
97
+ "from django.urls import path, include"
98
+ )
99
+ updated = True
100
+
101
+ # Verificar o agregar la lista urlpatterns
102
+ if 'urlpatterns = [' not in urls_content:
103
+ stdout.write("No se encontró 'urlpatterns'. Creando la lista de rutas desde cero.")
104
+ urls_content += "\nurlpatterns = [\n path('admin/', admin.site.urls),\n]\n"
105
+ updated = True
106
+
107
+ # Verificar o agregar la ruta para 'home.urls'
108
+ if "include('home.urls')" not in urls_content:
109
+ stdout.write("Agregando ruta para 'home.urls'.")
110
+ urls_content = urls_content.replace(
111
+ "urlpatterns = [",
112
+ "urlpatterns = [\n path('', include('home.urls')),\n"
113
+ )
114
+ updated = True
115
+
116
+ # Escribir los cambios si se modificó algo
117
+ if updated:
118
+ with open(project_urls_path, 'w') as f:
119
+ f.write(urls_content)
120
+ stdout.write(f"El archivo '{project_urls_path}' fue actualizado.")
84
121
  else:
85
- # Si el archivo ya existe, lo leemos y agregamos nuevas rutas
86
- stdout.write(f"El archivo '{urls_path}' ya existe. Agregando nuevas rutas...")
87
-
88
- with open(urls_path, 'r') as f:
89
- urls_content = f.read()
90
-
91
- # Verificar si ya existe una lista 'urlpatterns'
92
- if 'urlpatterns = [' in urls_content:
93
- # Verificar si 'path' ya está en la lista
94
- if 'path' not in urls_content:
95
- urls_content = urls_content.replace(
96
- "urlpatterns = [",
97
- "urlpatterns = [\n path('admin/', admin.site.urls),"
98
- )
99
- # Verificar si 'include' ya está presente en urlpatterns
100
- if 'include' not in urls_content:
101
- urls_content = urls_content.replace(
102
- "]\n",
103
- " path('', include('home.urls')),\n # Otras rutas aquí\n]"
104
- )
105
- else:
106
- # Si ya contiene 'include', solo agregamos una nueva ruta
107
- urls_content = urls_content.replace(
108
- "]\n",
109
- " path('', include('home.urls')),\n # Otras rutas aquí\n]"
110
- )
111
-
112
- # Escribir el contenido actualizado en el archivo
113
- with open(urls_path, 'w') as f:
114
- f.write(urls_content)
115
- stdout.write(f"Nuevas rutas fueron agregadas a '{urls_path}'.")
116
- else:
117
- stdout.write(f"No se encontró la lista 'urlpatterns' en '{urls_path}'.")
122
+ stdout.write(f"No fue necesario realizar cambios en '{project_urls_path}'.")
118
123
 
119
124
  def creation_auth(self, stdout):
120
125
  services_dir = os.path.join(self.app_name, 'services')
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
4
  name='componentsDjangoType',
5
- version='2.0.15',
5
+ version='2.0.17',
6
6
  packages=find_packages(),
7
7
  include_package_data=True,
8
8
  license='MIT',