componentsDjangoType 2.0.32__tar.gz → 2.0.34__tar.gz

Sign up to get free protection for your applications and to get access to all the features.
Files changed (27) hide show
  1. {componentsdjangotype-2.0.32/componentsDjangoType.egg-info → componentsdjangotype-2.0.34}/PKG-INFO +1 -1
  2. componentsdjangotype-2.0.34/componentsDjangoType/management/commands/createApp.py +37 -0
  3. {componentsdjangotype-2.0.32 → componentsdjangotype-2.0.34/componentsDjangoType.egg-info}/PKG-INFO +1 -1
  4. {componentsdjangotype-2.0.32 → componentsdjangotype-2.0.34}/componentsDjangoType.egg-info/SOURCES.txt +3 -1
  5. {componentsdjangotype-2.0.32 → componentsdjangotype-2.0.34}/services/authentication/auth.py +29 -32
  6. componentsdjangotype-2.0.34/services/authentication/forms.py +15 -0
  7. {componentsdjangotype-2.0.32 → componentsdjangotype-2.0.34}/services/authenticator_configurator.py +37 -26
  8. componentsdjangotype-2.0.34/services/copy_source.py +32 -0
  9. {componentsdjangotype-2.0.32 → componentsdjangotype-2.0.34}/setup.py +1 -1
  10. componentsdjangotype-2.0.32/componentsDjangoType/management/commands/createApp.py +0 -419
  11. {componentsdjangotype-2.0.32 → componentsdjangotype-2.0.34}/LICENSE +0 -0
  12. {componentsdjangotype-2.0.32 → componentsdjangotype-2.0.34}/MANIFEST.in +0 -0
  13. {componentsdjangotype-2.0.32 → componentsdjangotype-2.0.34}/README.md +0 -0
  14. {componentsdjangotype-2.0.32 → componentsdjangotype-2.0.34}/componentsDjangoType/__init__.py +0 -0
  15. {componentsdjangotype-2.0.32 → componentsdjangotype-2.0.34}/componentsDjangoType/__pycache__/__init__.cpython-312.pyc +0 -0
  16. {componentsdjangotype-2.0.32 → componentsdjangotype-2.0.34}/componentsDjangoType/management/__init__.py +0 -0
  17. {componentsdjangotype-2.0.32 → componentsdjangotype-2.0.34}/componentsDjangoType/management/__pycache__/__init__.cpython-312.pyc +0 -0
  18. {componentsdjangotype-2.0.32 → componentsdjangotype-2.0.34}/componentsDjangoType/management/commands/__init__.py +0 -0
  19. {componentsdjangotype-2.0.32 → componentsdjangotype-2.0.34}/componentsDjangoType/management/commands/__pycache__/__init__.cpython-312.pyc +0 -0
  20. {componentsdjangotype-2.0.32 → componentsdjangotype-2.0.34}/componentsDjangoType/management/commands/__pycache__/createApp.cpython-312.pyc +0 -0
  21. {componentsdjangotype-2.0.32 → componentsdjangotype-2.0.34}/componentsDjangoType/management/commands/createcomponent.py +0 -0
  22. {componentsdjangotype-2.0.32 → componentsdjangotype-2.0.34}/componentsDjangoType.egg-info/dependency_links.txt +0 -0
  23. {componentsdjangotype-2.0.32 → componentsdjangotype-2.0.34}/componentsDjangoType.egg-info/requires.txt +0 -0
  24. {componentsdjangotype-2.0.32 → componentsdjangotype-2.0.34}/componentsDjangoType.egg-info/top_level.txt +0 -0
  25. {componentsdjangotype-2.0.32 → componentsdjangotype-2.0.34}/services/__init__.py +0 -0
  26. {componentsdjangotype-2.0.32 → componentsdjangotype-2.0.34}/services/authentication/__init__.py +0 -0
  27. {componentsdjangotype-2.0.32 → componentsdjangotype-2.0.34}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: componentsDjangoType
3
- Version: 2.0.32
3
+ Version: 2.0.34
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
@@ -0,0 +1,37 @@
1
+ import os
2
+ from django.core.management.base import BaseCommand
3
+ from services.authenticator_configurator import DjangoProjectManager
4
+
5
+ class Command(BaseCommand):
6
+ help = 'Crea una aplicación llamada Home, estructura de carpetas y configura urls automáticamente en el proyecto especificado'
7
+
8
+ def handle(self, *args, **kwargs):
9
+ # Nombre de la aplicación a crear
10
+ app_name = "Home"
11
+
12
+ # Paso 1: Solicitar el nombre de la aplicación principal al usuario
13
+ project_name = input(
14
+ "Por favor, ingresa el nombre de la aplicación principal del proyecto: ")
15
+
16
+ creation = DjangoProjectManager(app_name=app_name, project_name=project_name)
17
+
18
+ # Paso 2: Crear la aplicación "Home" si no existe
19
+ creation.create_app()
20
+
21
+ # Agregar automáticamente 'Home' a INSTALLED_APPS
22
+ creation.installed_app()
23
+
24
+ # Paso 3: Crear el archivo urls.py en la aplicación "Home" si no existe
25
+ creation.create_urls(self.stdout)
26
+
27
+ # Paso 4: Crear la carpeta services y el archivo authentication.py en Home
28
+ creation.creation_auth(self.stdout)
29
+
30
+ # Paso 5: crea el urls.py y modifica el archivo views.py
31
+ creation.create_views_urls(self.stdout)
32
+
33
+ # Paso 6: Crear la carpeta templates y estatic y los archivos HTML CSS y JS
34
+ creation.creation_utils(self.stdout)
35
+
36
+ self.stdout.write(self.style.SUCCESS(
37
+ "Comando ejecutado exitosamente."))
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: componentsDjangoType
3
- Version: 2.0.32
3
+ Version: 2.0.34
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
@@ -18,5 +18,7 @@ componentsDjangoType/management/commands/__pycache__/__init__.cpython-312.pyc
18
18
  componentsDjangoType/management/commands/__pycache__/createApp.cpython-312.pyc
19
19
  services/__init__.py
20
20
  services/authenticator_configurator.py
21
+ services/copy_source.py
21
22
  services/authentication/__init__.py
22
- services/authentication/auth.py
23
+ services/authentication/auth.py
24
+ services/authentication/forms.py
@@ -1,64 +1,61 @@
1
1
  from django.shortcuts import render, redirect
2
- from django.contrib.auth.forms import UserCreationForm, AuthenticationForm
3
- from django.contrib.auth.models import User
4
- from django.contrib.auth import login, logout, authenticate
2
+ from django.contrib.auth.forms import AuthenticationForm
3
+ from django.contrib.auth import login, logout
5
4
  from django.db import IntegrityError
5
+ from forms import customUserCreationform
6
+
6
7
  class Authentication:
7
8
  @staticmethod
8
9
  def get_signup(request):
9
10
  if request.method == 'GET':
10
11
  return render(request, 'signup.html', {
11
- 'form': UserCreationForm()
12
+ 'form': customUserCreationform
12
13
  })
13
14
  elif request.method == 'POST':
14
- if request.POST['password1'] == request.POST['password2']:
15
+ form = customUserCreationform(request.POST)
16
+ if form.is_valid():
15
17
  try:
16
- # Register user\n"
17
- user = User.objects.create_user(
18
- username=request.POST['username'], password=request.POST['password2'])
19
- user.save()
18
+ user = form.save()
20
19
  login(request, user)
21
20
  return redirect('logged')
22
21
  except IntegrityError:
23
- return render(request, 'signup.html', {
24
- 'form': UserCreationForm(),
25
- 'error': 'User already exists'
22
+ return render(request, 'singup.html', {
23
+ 'form': form,
24
+ 'error': 'Unable to register. Please try again later.'
26
25
  })
27
- return render(request, 'signup.html', {
28
- 'form': UserCreationForm(),
29
- 'error': 'Passwords do not match'
30
- })
26
+ else:
27
+ return render(request, 'singup.html', {
28
+ 'form': form,
29
+ 'error': 'Please correct the errors below.'
30
+ })
31
+
31
32
  @staticmethod
32
33
  def get_signout(request):
33
34
  logout(request)
34
35
  return redirect('home')
36
+
35
37
  @staticmethod
36
38
  def get_signing(request):
37
39
  if request.method == 'GET':
38
40
  return render(request, 'login.html', {
39
- 'form': AuthenticationForm,
41
+ 'form': AuthenticationForm()
40
42
  })
41
43
  elif request.method == 'POST':
42
- try:
43
- User.objects.get(username=request.POST['username'])
44
- except User.DoesNotExist:
45
- return render(request, 'login.html', {
46
- 'form': AuthenticationForm,
47
- 'error': 'User does not exist in the database'
48
- })
49
- user = authenticate(
50
- request, username=request.POST['username'], password=request.POST['password'])
51
- if user is None:
52
- return render(request, 'login.html', {
53
- 'form': AuthenticationForm,
54
- 'error': 'username or password is incorrect'
55
- })
56
- else:
44
+ form = AuthenticationForm(data=request.POST)
45
+ if form.is_valid():
46
+ user = form.get_user()
57
47
  login(request, user)
58
48
  return redirect('logged')
49
+ else:
50
+ return render(request, 'login.html', {
51
+ 'form': form,
52
+ 'error': 'Invalid username or password. Please try again.'
53
+ })
54
+
59
55
  @staticmethod
60
56
  def get_logged(request):
61
57
  return render(request, 'logged.html')
58
+
62
59
  def dispatch(self, request, *args, **kwargs):
63
60
  match request.path:
64
61
  case "/signup":
@@ -0,0 +1,15 @@
1
+ from django import forms
2
+ from django.contrib.auth.forms import UserCreationForm
3
+ from django.contrib.auth.models import User
4
+
5
+ class customUserCreationform(UserCreationForm):
6
+ class Meta:
7
+ model = User
8
+ fields = ['username', 'password1', 'password2']
9
+
10
+ def clean_username(self):
11
+ username = self.cleaned_data['username']
12
+
13
+ if not username.isalnum():
14
+ raise forms.ValidationError("El nombre de usuario solo puede contener letras y números.")
15
+ return username
@@ -1,6 +1,6 @@
1
1
  import os
2
2
  import ast
3
- from django.core.management.base import BaseCommand
3
+ from services.copy_source import copy_static_file
4
4
  from django.core.management import call_command
5
5
  from services.authentication import auth
6
6
 
@@ -111,7 +111,7 @@ Including another URLconf
111
111
  2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
112
112
  """
113
113
  from django.contrib import admin
114
- from django.urls import path, include # Asegúrate de incluir include
114
+ from django.urls import path, include
115
115
 
116
116
  urlpatterns = [
117
117
  path('admin/', admin.site.urls),
@@ -214,29 +214,40 @@ urlpatterns = [
214
214
  stdout.write(f"El archivo '{urls_path}' ha sido creado.\n")
215
215
  else:
216
216
  stdout.write(f"El archivo '{urls_path}' ya existe.\n")
217
+
217
218
 
219
+ def creation_utils(self, stdout):
218
220
 
219
-
220
-
221
-
222
-
223
-
224
-
225
-
226
-
227
-
228
-
229
-
230
-
231
-
232
-
233
-
234
-
235
-
236
-
237
-
238
-
239
-
240
-
241
-
242
-
221
+ app_name = self.app_name
222
+ #creacion de los directorios
223
+ templates_dir = os.path.join(app_name, 'templates')
224
+ static_dir = os.path.join(app_name, 'static')
225
+
226
+ #creacin de subcarpetas
227
+ layouts_dir = os.path.join(templates_dir, 'layouts')
228
+ js_dir = os.path.join(static_dir, 'js')
229
+ css_dir = os.path.join(static_dir, 'css')
230
+
231
+ # Crear las carpetas principales y subcarpetas
232
+ os.makedirs(templates_dir, exist_ok=True)
233
+ os.makedirs(layouts_dir, exist_ok=True)
234
+ os.makedirs(static_dir, exist_ok=True)
235
+ os.makedirs(js_dir, exist_ok=True)
236
+ os.makedirs(css_dir, exist_ok=True)
237
+
238
+ stdout.write("Estructura de carpetas creada.\n")
239
+
240
+ files_to_copy = [
241
+ ("services/utils/js/alertErrors.js", os.path.join(js_dir, "alertErrors.js")),
242
+ ("services/utils/css/authentication.css", os.path.join(css_dir, "authentication.css")),
243
+ ("services/utils/views/layouts/index.html", os.path.join(layouts_dir, "index.html")),
244
+ ("services/utils/views/home.html", os.path.join(templates_dir, "home.html")),
245
+ ("services/utils/views/singup.html", os.path.join(templates_dir, "singup.html")),
246
+ ("services/utils/views/login.html", os.path.join(templates_dir, "login.html")),
247
+ ("services/utils/views/logged.html", os.path.join(templates_dir, "logged.html")),
248
+ ]
249
+
250
+ for source_path, destination_path in files_to_copy:
251
+ copy_static_file(source_path, destination_path, stdout)
252
+
253
+ stdout.write("Archivos estáticos copiados.\n")
@@ -0,0 +1,32 @@
1
+ import os
2
+ import shutil
3
+ import sys
4
+
5
+ def copy_static_file(source_path, destination_path, stdout=sys.stdout):
6
+ """
7
+ Copia un archivo estático (HTML, CSS, JS) a una ruta de destino.
8
+
9
+ :param source_path: Ruta completa del archivo fuente.
10
+ :param destination_path: Ruta completa del archivo destino.
11
+ :param stdout: Salida estándar para mensajes (por defecto usa sys.stdout).
12
+ """
13
+ try:
14
+ # Verificar si el archivo fuente existe
15
+ if not os.path.exists(source_path):
16
+ stdout.write(f"El archivo fuente '{source_path}' no existe.\n")
17
+ return
18
+
19
+ # Crear el directorio de destino si no existe
20
+ os.makedirs(os.path.dirname(destination_path), exist_ok=True)
21
+
22
+ # Verificar si el archivo de destino ya existe
23
+ if os.path.exists(destination_path):
24
+ stdout.write(f"El archivo '{destination_path}' ya existe.\n")
25
+ return
26
+
27
+ # Copiar el archivo al destino
28
+ shutil.copy(source_path, destination_path)
29
+ stdout.write(f"El archivo '{source_path}' fue copiado a '{destination_path}'.\n")
30
+
31
+ except Exception as e:
32
+ stdout.write(f"Error al copiar el archivo: {e}\n")
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
4
  name='componentsDjangoType',
5
- version='2.0.32',
5
+ version='2.0.34',
6
6
  packages=find_packages(),
7
7
  include_package_data=True,
8
8
  license='MIT',
@@ -1,419 +0,0 @@
1
- import os
2
- from django.core.management.base import BaseCommand
3
- from services.authenticator_configurator import DjangoProjectManager
4
-
5
- class Command(BaseCommand):
6
- help = 'Crea una aplicación llamada Home, estructura de carpetas y configura urls automáticamente en el proyecto especificado'
7
-
8
- def handle(self, *args, **kwargs):
9
- # Nombre de la aplicación a crear
10
- app_name = "Home"
11
-
12
- # definiendoerrores
13
- def write_file(file_path, content):
14
- try:
15
- with open(file_path, 'w') as file:
16
- file.write(content)
17
- print(f"Archivo escrito correctamente: {file_path}")
18
- except Exception as e:
19
- print(f"Error al escribir el archivo {file_path}: {e}")
20
-
21
- # Paso 1: Solicitar el nombre de la aplicación principal al usuario
22
- project_name = input(
23
- "Por favor, ingresa el nombre de la aplicación principal del proyecto: ")
24
-
25
- creation = DjangoProjectManager(app_name=app_name, project_name=project_name)
26
-
27
- # Paso 2: Crear la aplicación "Home" si no existe
28
- creation.create_app()
29
-
30
- # Agregar automáticamente 'Home' a INSTALLED_APPS
31
- creation.installed_app()
32
-
33
- # Paso 3: Crear el archivo urls.py en la aplicación "Home" si no existe
34
- creation.create_urls(self.stdout)
35
-
36
- # Paso 4: Crear la carpeta services y el archivo authentication.py en Home
37
- creation.creation_auth(self.stdout)
38
-
39
- creation.create_views_urls(self. stdout)
40
-
41
- # Paso 8: Crear la carpeta templates y estatic y los archivos HTML CSS y JS
42
- templates_dir = os.path.join(app_name, 'templates')
43
- static_dir = os.path.join(app_name, 'static')
44
-
45
- # creacion de sub carpetas
46
- layouts_dir = os.path.join(templates_dir, 'layouts')
47
- js_dir = os.path.join(static_dir, 'js')
48
- css_dir = os.path.join(static_dir, 'css')
49
-
50
- # Crear las carpetas principales y subcarpetas
51
- os.makedirs(templates_dir, exist_ok=True)
52
- os.makedirs(static_dir, exist_ok=True)
53
- os.makedirs(layouts_dir, exist_ok=True)
54
- os.makedirs(js_dir, exist_ok=True)
55
- os.makedirs(css_dir, exist_ok=True)
56
-
57
- # creacion de los archivos
58
-
59
- js_file_path = os.path.join(js_dir, 'alertErrors.js')
60
-
61
- css_file_path = os.path.join(css_dir, 'authentication.css')
62
-
63
- layout_files_path = os.path.join(layouts_dir, 'index.html')
64
-
65
- template_files = {
66
- 'home.html': """{% extends "layouts/index.html" %}
67
- {% block layout %}
68
- {% endblock %}""",
69
- 'signup.html': """{% extends "layouts/index.html" %}
70
- {% block layout %}
71
- {% if error %}
72
- <div class="alert" id="alert">
73
- <div class="alert-content">
74
- {{ error }}
75
- <button class="close-btn" onclick="closeAlert()">
76
- <span class="sr-only">Close</span>
77
- <svg class="close-icon" width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
78
- <path d="M0.92524 0.687069C1.126 0.486219 1.39823 0.373377 1.68209 0.373377C1.96597 0.373377 2.2382 0.486219 2.43894 0.687069L8.10514 6.35813L13.7714 0.687069C13.8701 0.584748 13.9882 0.503105 14.1188 0.446962C14.2494 0.39082 14.3899 0.361248 14.5321 0.360026C14.6742 0.358783 14.8151 0.38589 14.9468 0.439762C15.0782 0.493633 15.1977 0.573197 15.2983 0.673783C15.3987 0.774389 15.4784 0.894026 15.5321 1.02568C15.5859 1.15736 15.6131 1.29845 15.6118 1.44071C15.6105 1.58297 15.5809 1.72357 15.5248 1.85428C15.4688 1.98499 15.3872 2.10324 15.2851 2.20206L9.61883 7.87312L15.2851 13.5441C15.4801 13.7462 15.588 14.0168 15.5854 14.2977C15.5831 14.5787 15.4705 14.8474 15.272 15.046C15.0735 15.2449 14.805 15.3574 14.5244 15.3599C14.2437 15.3623 13.9733 15.2543 13.7714 15.0591L8.10514 9.38812L2.43894 15.0591C2.23704 15.2543 1.96663 15.3623 1.68594 15.3599C1.40526 15.3574 1.13677 15.2449 0.938279 15.046C0.739807 14.8474 0.627232 14.5787 0.624791 14.2977C0.62235 14.0168 0.730236 13.7462 0.92524 13.5441L6.59144 7.87312L0.92524 2.20206C0.724562 2.00115 0.611816 1.72867 0.611816 1.44457C0.611816 1.16047 0.724562 0.887983 0.92524 0.687069Z" fill="currentColor"/>
79
- </svg>
80
- </button>
81
- </div>
82
- </div>
83
- {% endif %}\n
84
- <div class="form-wrapper">
85
- <div class="form-container">
86
- <form action="" method="post" class="form-control">
87
- {% csrf_token %}
88
- <h1>sing up</h1>
89
-
90
- <label for="username">Usuario:</label>
91
- {{ form.username }}
92
-
93
- <label for="password1">Contraseña:</label>
94
- {{ form.password1 }}
95
-
96
- <label for="password2">Confirmar Contraseña:</label>
97
- {{ form.password2 }}
98
-
99
- <button type="submit">sing Up</button>
100
- </form>
101
- </div>
102
- </div>
103
- {% endblock %}
104
- """,
105
- 'login.html': """{% extends "layouts/index.html" %}
106
- {% block layout %}
107
- {% if error %}
108
- <div class="alert" id="alert">
109
- <div class="alert-content">
110
- {{ error }}
111
- <button class="close-btn" onclick="closeAlert()">
112
- <span class="sr-only">Close</span>
113
- <svg class="close-icon" width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
114
- <path d="M0.92524 0.687069C1.126 0.486219 1.39823 0.373377 1.68209 0.373377C1.96597 0.373377 2.2382 0.486219 2.43894 0.687069L8.10514 6.35813L13.7714 0.687069C13.8701 0.584748 13.9882 0.503105 14.1188 0.446962C14.2494 0.39082 14.3899 0.361248 14.5321 0.360026C14.6742 0.358783 14.8151 0.38589 14.9468 0.439762C15.0782 0.493633 15.1977 0.573197 15.2983 0.673783C15.3987 0.774389 15.4784 0.894026 15.5321 1.02568C15.5859 1.15736 15.6131 1.29845 15.6118 1.44071C15.6105 1.58297 15.5809 1.72357 15.5248 1.85428C15.4688 1.98499 15.3872 2.10324 15.2851 2.20206L9.61883 7.87312L15.2851 13.5441C15.4801 13.7462 15.588 14.0168 15.5854 14.2977C15.5831 14.5787 15.4705 14.8474 15.272 15.046C15.0735 15.2449 14.805 15.3574 14.5244 15.3599C14.2437 15.3623 13.9733 15.2543 13.7714 15.0591L8.10514 9.38812L2.43894 15.0591C2.23704 15.2543 1.96663 15.3623 1.68594 15.3599C1.40526 15.3574 1.13677 15.2449 0.938279 15.046C0.739807 14.8474 0.627232 14.5787 0.624791 14.2977C0.62235 14.0168 0.730236 13.7462 0.92524 13.5441L6.59144 7.87312L0.92524 2.20206C0.724562 2.00115 0.611816 1.72867 0.611816 1.44457C0.611816 1.16047 0.724562 0.887983 0.92524 0.687069Z" fill="currentColor"/>
115
- </svg>
116
- </button>
117
- </div>
118
- </div>
119
- {% endif %}
120
- <div class="form-wrapper">\n
121
- <div class="form-container">
122
- <form action="" method="post" class="form-control">
123
- {% csrf_token %}
124
- <h1>Login</h1>
125
-
126
- <label for="username">Usuario:</label>
127
- {{ form.username }}
128
-
129
- <label for="password">Contraseña:</label>
130
- <input type="password" id="password" name="password" value="{{ form.password2 }}" required>
131
-
132
- <button type="submit">Login</button>
133
- </form>
134
- </div>
135
- </div>
136
- {% endblock %}
137
- """,
138
- 'logged.html': """{% extends "layouts/index.html" %}
139
- {% block layout %}
140
- <div class="layout-container">
141
- <h1>¡Has iniciado sesión!</h1>
142
- </div>
143
- {% endblock %}"""
144
- }
145
- for template_file, content in template_files.items():
146
- template_file_path = os.path.join(templates_dir, template_file)
147
- # escritura de los archivoos html
148
- write_file(template_file_path, content)
149
-
150
- # escritura de los archivos
151
-
152
- # escritura del archivos js
153
- write_file(js_file_path, """function closeAlert() {
154
- const alert = document.getElementById('alert');
155
- if (alert) {
156
- alert.remove();
157
- }
158
- }
159
- """)
160
-
161
- # escritura del archivo css
162
- write_file(css_file_path, """
163
- /* Navbar */
164
- .navbar {
165
- display: flex;
166
- justify-content: space-between;
167
- align-items: center;
168
- padding: 10px 20px;
169
- background-color: #333; /* Color de fondo */
170
- box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
171
- }
172
-
173
- /* Logo */
174
- .navbar .logo a {
175
- color: #ffffff;
176
- font-size: 1.5em;
177
- text-decoration: none;
178
- transition: color 0.3s ease;
179
- }
180
-
181
- .navbar .logo a:hover {
182
- color: #4a90e2; /* Hover del logo */
183
- }
184
-
185
- /* Links de navegación */
186
- .nav-links {
187
- display: flex;
188
- gap: 15px;
189
- list-style: none;
190
- margin: 0;
191
- padding: 0;
192
- }
193
-
194
- .nav-links .nav-item {
195
- color: #ffffff;
196
- font-size: 1em;
197
- text-decoration: none;
198
- padding: 8px 15px;
199
- border-radius: 5px;
200
- transition: background-color 0.3s ease, color 0.3s ease;
201
- }
202
-
203
- .nav-links .nav-item:hover {
204
- background-color: #4a90e2; /* Hover */
205
- color: #ffffff;
206
- }
207
-
208
- /* Estilos para dispositivos móviles */
209
- .menu-toggle {
210
- display: none;
211
- }
212
-
213
- @media (max-width: 768px) {
214
- .menu-toggle {
215
- display: inline-block;
216
- font-size: 1.5em;
217
- color: #ffffff;
218
- cursor: pointer;
219
- padding: 8px 15px;
220
- }
221
-
222
- .nav-links {
223
- flex-direction: column;
224
- position: absolute;
225
- top: 100%;
226
- right: 0;
227
- width: 100%;
228
- background-color: #333;
229
- max-height: 0;
230
- overflow: hidden;
231
- transition: max-height 0.3s ease;
232
- }
233
-
234
- /* Activar menú desplegable */
235
- .nav-links.active {
236
- max-height: 300px; /* Ajustar altura */
237
- }
238
-
239
- .nav-links .nav-item {
240
- padding: 10px 20px;
241
- }
242
- }
243
-
244
- /* formularios */
245
- /* Contenedor para centrar el formulario */
246
- .form-wrapper {
247
- display: flex;
248
- justify-content: center;
249
- align-items: center;
250
- margin-top: 50px;
251
- }
252
-
253
- /* Contenedor del formulario */
254
- .form-container {
255
- padding: 20px;
256
- background: black; /* Fondo azul con transparencia */
257
- border-radius: 8px;
258
- box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
259
- color: white;
260
- text-align: center;
261
- max-width: 400px;
262
- width: 100%;
263
- }
264
-
265
- /* Estilo del formulario */
266
- .form-control {
267
- display: flex;
268
- flex-direction: column;
269
- gap: 15px;
270
- }
271
-
272
- /* Estilo para las etiquetas */
273
- label {
274
- font-size: 0.9em;
275
- color: #d1d5db; /* Color gris claro */
276
- margin-bottom: 5px;
277
- text-align: left;
278
- }
279
-
280
- /* Estilo para los campos de entrada */
281
- input[type="text"],
282
- input[type="password"] {
283
- padding: 10px;
284
- background: rgba(255, 255, 255, 0.2);
285
- border: 1px solid rgba(255, 255, 255, 0.3);
286
- border-radius: 5px;
287
- color: #ffffff;
288
- outline: none;
289
- font-size: 1em;
290
- transition: background 0.3s ease, box-shadow 0.3s ease;
291
- }
292
-
293
- input[type="text"]:focus,
294
- input[type="password"]:focus {
295
- background: rgba(255, 255, 255, 0.4);
296
- box-shadow: 0 0 5px rgba(255, 255, 255, 0.5);
297
- }
298
-
299
- /* Estilo del botón */
300
- button[type="submit"] {
301
- padding: 10px;
302
- background: #4a90e2;
303
- color: white;
304
- border: none;
305
- border-radius: 5px;
306
- cursor: pointer;
307
- transition: background 0.3s ease;
308
- }
309
-
310
- button[type="submit"]:hover {
311
- background: #357ab8;
312
- }
313
-
314
- /* alert */
315
-
316
- /* Estilos para la alerta */
317
- .alert {
318
- max-width: 400px;
319
- background-color: #333;
320
- color: #ffffff;
321
- border-radius: 8px;
322
- box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
323
- margin: 0 auto;
324
- position: relative;
325
- top: 20px;
326
- padding: 15px;
327
- }
328
-
329
- .alert-content {
330
- display: flex;
331
- justify-content: space-between;
332
- align-items: center;
333
- }
334
-
335
- .close-btn {
336
- background: none;
337
- border: none;
338
- cursor: pointer;
339
- color: #ffffff;
340
- transition: color 0.3s ease;
341
- }
342
-
343
- .close-btn:hover {
344
- color: #ff6b6b;
345
- }
346
-
347
- .close-icon {
348
- width: 16px;
349
- height: 16px;
350
- }
351
-
352
- /* logged */
353
-
354
- /* Estilos para el contenedor del bloque */
355
- .layout-container {
356
- display: flex;
357
- justify-content: center;
358
- align-items: center;
359
- height: 100vh;
360
- background-color: #f0f4f8;
361
- font-family: Arial, sans-serif;
362
- }
363
-
364
- /* Estilos para el título */
365
- .layout-container h1 {
366
- font-size: 2.5rem;
367
- color: #4a90e2;
368
- font-weight: bold;
369
- text-align: center;
370
- padding: 20px;
371
- border-radius: 8px;
372
- background: #ffffff;
373
- box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
374
- }
375
- """)
376
- # escritura del archivos que estan en la carpeta layouts
377
- write_file(layout_files_path, """{% load static %}
378
- <!DOCTYPE html>
379
- <html lang="en">
380
- <head>
381
- <meta charset="UTF-8">
382
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
383
- <link rel="stylesheet" href="{% static 'css/authentication.css' %}">
384
- <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.6.0/css/all.min.css">
385
- <title>django components</title>
386
- </head>
387
- <body class="bg-gray-100 text-gray-800">
388
-
389
- <nav class="navbar">
390
- <div class="logo">
391
- <a href="{% url 'home' %}">
392
- <i class="fa-solid fa-house"></i>
393
- </a>
394
- </div>
395
- <div class="menu-toggle">
396
- <i class="fa fa-bars"></i>
397
- </div>
398
- <ul class="nav-links">
399
- {% if user.is_authenticated %}
400
- <li><a href="{% url 'logout' %}" class="nav-item">Logout</a></li>
401
- {% else %}
402
- <li><a href="{% url 'signup' %}" class="nav-item">Sign Up</a></li>
403
- <li><a href="{% url 'login' %}" class="nav-item">Login</a></li>
404
- {% endif %}
405
- </ul>
406
- </nav>
407
-
408
- <div class="container mx-auto p-4">
409
- {% block layout %}
410
- {% endblock %}
411
- </div>
412
-
413
- <script src="{% static 'js/alertErrors.js'%}"></script>
414
- </body>
415
- </html>
416
- """)
417
-
418
- self.stdout.write(self.style.SUCCESS(
419
- "Comando ejecutado exitosamente."))