componentsDjangoType 2.0.33__tar.gz → 2.0.34__tar.gz
Sign up to get free protection for your applications and to get access to all the features.
- {componentsdjangotype-2.0.33/componentsDjangoType.egg-info → componentsdjangotype-2.0.34}/PKG-INFO +1 -1
- componentsdjangotype-2.0.34/componentsDjangoType/management/commands/createApp.py +37 -0
- {componentsdjangotype-2.0.33 → componentsdjangotype-2.0.34/componentsDjangoType.egg-info}/PKG-INFO +1 -1
- {componentsdjangotype-2.0.33 → componentsdjangotype-2.0.34}/componentsDjangoType.egg-info/SOURCES.txt +1 -4
- {componentsdjangotype-2.0.33 → componentsdjangotype-2.0.34}/services/authentication/auth.py +2 -2
- {componentsdjangotype-2.0.33 → componentsdjangotype-2.0.34}/services/authenticator_configurator.py +10 -1
- {componentsdjangotype-2.0.33 → componentsdjangotype-2.0.34}/setup.py +1 -1
- componentsdjangotype-2.0.33/componentsDjangoType/management/commands/createApp.py +0 -187
- componentsdjangotype-2.0.33/services/utils/__init__.py +0 -0
- componentsdjangotype-2.0.33/services/utils/css/__init__.py +0 -0
- componentsdjangotype-2.0.33/services/utils/js/__init__.py +0 -0
- {componentsdjangotype-2.0.33 → componentsdjangotype-2.0.34}/LICENSE +0 -0
- {componentsdjangotype-2.0.33 → componentsdjangotype-2.0.34}/MANIFEST.in +0 -0
- {componentsdjangotype-2.0.33 → componentsdjangotype-2.0.34}/README.md +0 -0
- {componentsdjangotype-2.0.33 → componentsdjangotype-2.0.34}/componentsDjangoType/__init__.py +0 -0
- {componentsdjangotype-2.0.33 → componentsdjangotype-2.0.34}/componentsDjangoType/__pycache__/__init__.cpython-312.pyc +0 -0
- {componentsdjangotype-2.0.33 → componentsdjangotype-2.0.34}/componentsDjangoType/management/__init__.py +0 -0
- {componentsdjangotype-2.0.33 → componentsdjangotype-2.0.34}/componentsDjangoType/management/__pycache__/__init__.cpython-312.pyc +0 -0
- {componentsdjangotype-2.0.33 → componentsdjangotype-2.0.34}/componentsDjangoType/management/commands/__init__.py +0 -0
- {componentsdjangotype-2.0.33 → componentsdjangotype-2.0.34}/componentsDjangoType/management/commands/__pycache__/__init__.cpython-312.pyc +0 -0
- {componentsdjangotype-2.0.33 → componentsdjangotype-2.0.34}/componentsDjangoType/management/commands/__pycache__/createApp.cpython-312.pyc +0 -0
- {componentsdjangotype-2.0.33 → componentsdjangotype-2.0.34}/componentsDjangoType/management/commands/createcomponent.py +0 -0
- {componentsdjangotype-2.0.33 → componentsdjangotype-2.0.34}/componentsDjangoType.egg-info/dependency_links.txt +0 -0
- {componentsdjangotype-2.0.33 → componentsdjangotype-2.0.34}/componentsDjangoType.egg-info/requires.txt +0 -0
- {componentsdjangotype-2.0.33 → componentsdjangotype-2.0.34}/componentsDjangoType.egg-info/top_level.txt +0 -0
- {componentsdjangotype-2.0.33 → componentsdjangotype-2.0.34}/services/__init__.py +0 -0
- {componentsdjangotype-2.0.33 → componentsdjangotype-2.0.34}/services/authentication/__init__.py +0 -0
- {componentsdjangotype-2.0.33 → componentsdjangotype-2.0.34}/services/authentication/forms.py +0 -0
- {componentsdjangotype-2.0.33 → componentsdjangotype-2.0.34}/services/copy_source.py +0 -0
- {componentsdjangotype-2.0.33 → componentsdjangotype-2.0.34}/setup.cfg +0 -0
@@ -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."))
|
@@ -21,7 +21,4 @@ services/authenticator_configurator.py
|
|
21
21
|
services/copy_source.py
|
22
22
|
services/authentication/__init__.py
|
23
23
|
services/authentication/auth.py
|
24
|
-
services/authentication/forms.py
|
25
|
-
services/utils/__init__.py
|
26
|
-
services/utils/css/__init__.py
|
27
|
-
services/utils/js/__init__.py
|
24
|
+
services/authentication/forms.py
|
@@ -19,12 +19,12 @@ class Authentication:
|
|
19
19
|
login(request, user)
|
20
20
|
return redirect('logged')
|
21
21
|
except IntegrityError:
|
22
|
-
return render(request, '
|
22
|
+
return render(request, 'singup.html', {
|
23
23
|
'form': form,
|
24
24
|
'error': 'Unable to register. Please try again later.'
|
25
25
|
})
|
26
26
|
else:
|
27
|
-
return render(request, '
|
27
|
+
return render(request, 'singup.html', {
|
28
28
|
'form': form,
|
29
29
|
'error': 'Please correct the errors below.'
|
30
30
|
})
|
{componentsdjangotype-2.0.33 → componentsdjangotype-2.0.34}/services/authenticator_configurator.py
RENAMED
@@ -220,13 +220,17 @@ urlpatterns = [
|
|
220
220
|
|
221
221
|
app_name = self.app_name
|
222
222
|
#creacion de los directorios
|
223
|
+
templates_dir = os.path.join(app_name, 'templates')
|
223
224
|
static_dir = os.path.join(app_name, 'static')
|
224
225
|
|
225
226
|
#creacin de subcarpetas
|
227
|
+
layouts_dir = os.path.join(templates_dir, 'layouts')
|
226
228
|
js_dir = os.path.join(static_dir, 'js')
|
227
229
|
css_dir = os.path.join(static_dir, 'css')
|
228
230
|
|
229
231
|
# Crear las carpetas principales y subcarpetas
|
232
|
+
os.makedirs(templates_dir, exist_ok=True)
|
233
|
+
os.makedirs(layouts_dir, exist_ok=True)
|
230
234
|
os.makedirs(static_dir, exist_ok=True)
|
231
235
|
os.makedirs(js_dir, exist_ok=True)
|
232
236
|
os.makedirs(css_dir, exist_ok=True)
|
@@ -235,7 +239,12 @@ urlpatterns = [
|
|
235
239
|
|
236
240
|
files_to_copy = [
|
237
241
|
("services/utils/js/alertErrors.js", os.path.join(js_dir, "alertErrors.js")),
|
238
|
-
("services/utils/css/authentication.css", os.path.join(css_dir, "authentication.css"))
|
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")),
|
239
248
|
]
|
240
249
|
|
241
250
|
for source_path, destination_path in files_to_copy:
|
@@ -1,187 +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
|
-
# Paso 5: crea el urls.py y modifica el archivo views.py
|
40
|
-
creation.create_views_urls(self.stdout)
|
41
|
-
|
42
|
-
# Paso 6: Crear la carpeta templates y estatic y los archivos HTML CSS y JS
|
43
|
-
templates_dir = os.path.join(app_name, 'templates')
|
44
|
-
|
45
|
-
# creacion de sub carpetas
|
46
|
-
layouts_dir = os.path.join(templates_dir, 'layouts')
|
47
|
-
|
48
|
-
# Crear las carpetas principales y subcarpetas
|
49
|
-
os.makedirs(templates_dir, exist_ok=True)
|
50
|
-
os.makedirs(layouts_dir, exist_ok=True)
|
51
|
-
|
52
|
-
creation.creation_utils(self.stdout)
|
53
|
-
|
54
|
-
# creacion de los archivos
|
55
|
-
|
56
|
-
layout_files_path = os.path.join(layouts_dir, 'index.html')
|
57
|
-
|
58
|
-
template_files = {
|
59
|
-
'home.html': """{% extends "layouts/index.html" %}
|
60
|
-
{% block layout %}
|
61
|
-
{% endblock %}""",
|
62
|
-
'signup.html': """{% extends "layouts/index.html" %}
|
63
|
-
{% block layout %}
|
64
|
-
{% if error %}
|
65
|
-
<div class="alert" id="alert">
|
66
|
-
<div class="alert-content">
|
67
|
-
{{ error }}
|
68
|
-
<button class="close-btn" onclick="closeAlert()">
|
69
|
-
<span class="sr-only">Close</span>
|
70
|
-
<svg class="close-icon" width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
71
|
-
<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"/>
|
72
|
-
</svg>
|
73
|
-
</button>
|
74
|
-
</div>
|
75
|
-
</div>
|
76
|
-
{% endif %}\n
|
77
|
-
<div class="form-wrapper">
|
78
|
-
<div class="form-container">
|
79
|
-
<form action="" method="post" class="form-control">
|
80
|
-
{% csrf_token %}
|
81
|
-
<h1>sing up</h1>
|
82
|
-
|
83
|
-
<label for="username">Usuario:</label>
|
84
|
-
{{ form.username }}
|
85
|
-
|
86
|
-
<label for="password1">Contraseña:</label>
|
87
|
-
{{ form.password1 }}
|
88
|
-
|
89
|
-
<label for="password2">Confirmar Contraseña:</label>
|
90
|
-
{{ form.password2 }}
|
91
|
-
|
92
|
-
<button type="submit">sing Up</button>
|
93
|
-
</form>
|
94
|
-
</div>
|
95
|
-
</div>
|
96
|
-
{% endblock %}
|
97
|
-
""",
|
98
|
-
'login.html': """{% extends "layouts/index.html" %}
|
99
|
-
{% block layout %}
|
100
|
-
{% if error %}
|
101
|
-
<div class="alert" id="alert">
|
102
|
-
<div class="alert-content">
|
103
|
-
{{ error }}
|
104
|
-
<button class="close-btn" onclick="closeAlert()">
|
105
|
-
<span class="sr-only">Close</span>
|
106
|
-
<svg class="close-icon" width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
107
|
-
<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"/>
|
108
|
-
</svg>
|
109
|
-
</button>
|
110
|
-
</div>
|
111
|
-
</div>
|
112
|
-
{% endif %}
|
113
|
-
<div class="form-wrapper">\n
|
114
|
-
<div class="form-container">
|
115
|
-
<form action="" method="post" class="form-control">
|
116
|
-
{% csrf_token %}
|
117
|
-
<h1>Login</h1>
|
118
|
-
|
119
|
-
<label for="username">Usuario:</label>
|
120
|
-
{{ form.username }}
|
121
|
-
|
122
|
-
<label for="password">Contraseña:</label>
|
123
|
-
<input type="password" id="password" name="password" value="{{ form.password2 }}" required>
|
124
|
-
|
125
|
-
<button type="submit">Login</button>
|
126
|
-
</form>
|
127
|
-
</div>
|
128
|
-
</div>
|
129
|
-
{% endblock %}
|
130
|
-
""",
|
131
|
-
'logged.html': """{% extends "layouts/index.html" %}
|
132
|
-
{% block layout %}
|
133
|
-
<div class="layout-container">
|
134
|
-
<h1>¡Has iniciado sesión!</h1>
|
135
|
-
</div>
|
136
|
-
{% endblock %}"""
|
137
|
-
}
|
138
|
-
for template_file, content in template_files.items():
|
139
|
-
template_file_path = os.path.join(templates_dir, template_file)
|
140
|
-
# escritura de los archivoos html
|
141
|
-
write_file(template_file_path, content)
|
142
|
-
|
143
|
-
# escritura de los archivos
|
144
|
-
# escritura del archivos que estan en la carpeta layouts
|
145
|
-
write_file(layout_files_path, """{% load static %}
|
146
|
-
<!DOCTYPE html>
|
147
|
-
<html lang="en">
|
148
|
-
<head>
|
149
|
-
<meta charset="UTF-8">
|
150
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
151
|
-
<link rel="stylesheet" href="{% static 'css/authentication.css' %}">
|
152
|
-
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.6.0/css/all.min.css">
|
153
|
-
<title>django components</title>
|
154
|
-
</head>
|
155
|
-
<body class="bg-gray-100 text-gray-800">
|
156
|
-
|
157
|
-
<nav class="navbar">
|
158
|
-
<div class="logo">
|
159
|
-
<a href="{% url 'home' %}">
|
160
|
-
<i class="fa-solid fa-house"></i>
|
161
|
-
</a>
|
162
|
-
</div>
|
163
|
-
<div class="menu-toggle">
|
164
|
-
<i class="fa fa-bars"></i>
|
165
|
-
</div>
|
166
|
-
<ul class="nav-links">
|
167
|
-
{% if user.is_authenticated %}
|
168
|
-
<li><a href="{% url 'logout' %}" class="nav-item">Logout</a></li>
|
169
|
-
{% else %}
|
170
|
-
<li><a href="{% url 'signup' %}" class="nav-item">Sign Up</a></li>
|
171
|
-
<li><a href="{% url 'login' %}" class="nav-item">Login</a></li>
|
172
|
-
{% endif %}
|
173
|
-
</ul>
|
174
|
-
</nav>
|
175
|
-
|
176
|
-
<div class="container mx-auto p-4">
|
177
|
-
{% block layout %}
|
178
|
-
{% endblock %}
|
179
|
-
</div>
|
180
|
-
|
181
|
-
<script src="{% static 'js/alertErrors.js'%}"></script>
|
182
|
-
</body>
|
183
|
-
</html>
|
184
|
-
""")
|
185
|
-
|
186
|
-
self.stdout.write(self.style.SUCCESS(
|
187
|
-
"Comando ejecutado exitosamente."))
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{componentsdjangotype-2.0.33 → componentsdjangotype-2.0.34}/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
|
File without changes
|
File without changes
|
File without changes
|
{componentsdjangotype-2.0.33 → componentsdjangotype-2.0.34}/services/authentication/__init__.py
RENAMED
File without changes
|
{componentsdjangotype-2.0.33 → componentsdjangotype-2.0.34}/services/authentication/forms.py
RENAMED
File without changes
|
File without changes
|
File without changes
|