componentsDjangoType 2.0.15__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.
Files changed (20) hide show
  1. {componentsdjangotype-2.0.15/componentsDjangoType.egg-info → componentsdjangotype-2.0.16}/PKG-INFO +1 -1
  2. {componentsdjangotype-2.0.15 → componentsdjangotype-2.0.16}/componentsDjangoType/management/commands/createApp.py +0 -5
  3. {componentsdjangotype-2.0.15 → componentsdjangotype-2.0.16/componentsDjangoType.egg-info}/PKG-INFO +1 -1
  4. {componentsdjangotype-2.0.15 → componentsdjangotype-2.0.16}/services/authenticator_configurator.py +50 -46
  5. {componentsdjangotype-2.0.15 → componentsdjangotype-2.0.16}/setup.py +1 -1
  6. {componentsdjangotype-2.0.15 → componentsdjangotype-2.0.16}/LICENSE +0 -0
  7. {componentsdjangotype-2.0.15 → componentsdjangotype-2.0.16}/MANIFEST.in +0 -0
  8. {componentsdjangotype-2.0.15 → componentsdjangotype-2.0.16}/README.md +0 -0
  9. {componentsdjangotype-2.0.15 → componentsdjangotype-2.0.16}/componentsDjangoType/__init__.py +0 -0
  10. {componentsdjangotype-2.0.15 → componentsdjangotype-2.0.16}/componentsDjangoType/management/__init__.py +0 -0
  11. {componentsdjangotype-2.0.15 → componentsdjangotype-2.0.16}/componentsDjangoType/management/commands/__init__.py +0 -0
  12. {componentsdjangotype-2.0.15 → componentsdjangotype-2.0.16}/componentsDjangoType/management/commands/createcomponent.py +0 -0
  13. {componentsdjangotype-2.0.15 → componentsdjangotype-2.0.16}/componentsDjangoType.egg-info/SOURCES.txt +0 -0
  14. {componentsdjangotype-2.0.15 → componentsdjangotype-2.0.16}/componentsDjangoType.egg-info/dependency_links.txt +0 -0
  15. {componentsdjangotype-2.0.15 → componentsdjangotype-2.0.16}/componentsDjangoType.egg-info/requires.txt +0 -0
  16. {componentsdjangotype-2.0.15 → componentsdjangotype-2.0.16}/componentsDjangoType.egg-info/top_level.txt +0 -0
  17. {componentsdjangotype-2.0.15 → componentsdjangotype-2.0.16}/services/__init__.py +0 -0
  18. {componentsdjangotype-2.0.15 → componentsdjangotype-2.0.16}/services/authentication/__init__.py +0 -0
  19. {componentsdjangotype-2.0.15 → componentsdjangotype-2.0.16}/services/authentication/auth.py +0 -0
  20. {componentsdjangotype-2.0.15 → componentsdjangotype-2.0.16}/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.16
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.16
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
@@ -63,58 +63,62 @@ 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')
78
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
79
77
  urlpatterns = [
80
78
  path('admin/', admin.site.urls),
81
- path('', include(Home.urls)),
79
+ path('', include('home.urls')),
82
80
  # Añade tus rutas aquí
83
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.")
84
120
  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}'.")
121
+ stdout.write(f"No fue necesario realizar cambios en '{project_urls_path}'.")
118
122
 
119
123
  def creation_auth(self, stdout):
120
124
  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.16',
6
6
  packages=find_packages(),
7
7
  include_package_data=True,
8
8
  license='MIT',