componentsDjangoType 1.0.4__tar.gz → 1.0.5__tar.gz
Sign up to get free protection for your applications and to get access to all the features.
- {componentsdjangotype-1.0.4/componentsDjangoType.egg-info → componentsdjangotype-1.0.5}/PKG-INFO +1 -1
- componentsdjangotype-1.0.5/componentsDjangoType/management/commands/createApp.py +551 -0
- {componentsdjangotype-1.0.4 → componentsdjangotype-1.0.5/componentsDjangoType.egg-info}/PKG-INFO +1 -1
- componentsdjangotype-1.0.5/componentsDjangoType.egg-info/SOURCES.txt +14 -0
- {componentsdjangotype-1.0.4 → componentsdjangotype-1.0.5}/setup.py +1 -4
- componentsdjangotype-1.0.4/componentsDjangoType/management/commands/createApp.py +0 -256
- componentsdjangotype-1.0.4/componentsDjangoType/management/commands/utils/css/authentication.css +0 -212
- componentsdjangotype-1.0.4/componentsDjangoType/management/commands/utils/js/alertErrors.js +0 -0
- componentsdjangotype-1.0.4/componentsDjangoType/management/commands/utils/layouts/index.html +0 -40
- componentsdjangotype-1.0.4/componentsDjangoType/management/commands/utils/pages/home.html +0 -3
- componentsdjangotype-1.0.4/componentsDjangoType/management/commands/utils/pages/logged.html +0 -6
- componentsdjangotype-1.0.4/componentsDjangoType/management/commands/utils/pages/login.html +0 -35
- componentsdjangotype-1.0.4/componentsDjangoType/management/commands/utils/pages/singup.html +0 -38
- componentsdjangotype-1.0.4/componentsDjangoType.egg-info/SOURCES.txt +0 -21
- {componentsdjangotype-1.0.4 → componentsdjangotype-1.0.5}/LICENSE +0 -0
- {componentsdjangotype-1.0.4 → componentsdjangotype-1.0.5}/MANIFEST.in +0 -0
- {componentsdjangotype-1.0.4 → componentsdjangotype-1.0.5}/README.md +0 -0
- {componentsdjangotype-1.0.4 → componentsdjangotype-1.0.5}/componentsDjangoType/__init__.py +0 -0
- {componentsdjangotype-1.0.4 → componentsdjangotype-1.0.5}/componentsDjangoType/management/__init__.py +0 -0
- {componentsdjangotype-1.0.4 → componentsdjangotype-1.0.5}/componentsDjangoType/management/commands/__init__.py +0 -0
- {componentsdjangotype-1.0.4 → componentsdjangotype-1.0.5}/componentsDjangoType/management/commands/createcomponent.py +0 -0
- {componentsdjangotype-1.0.4 → componentsdjangotype-1.0.5}/componentsDjangoType.egg-info/dependency_links.txt +0 -0
- {componentsdjangotype-1.0.4 → componentsdjangotype-1.0.5}/componentsDjangoType.egg-info/requires.txt +0 -0
- {componentsdjangotype-1.0.4 → componentsdjangotype-1.0.5}/componentsDjangoType.egg-info/top_level.txt +0 -0
- {componentsdjangotype-1.0.4 → componentsdjangotype-1.0.5}/setup.cfg +0 -0
@@ -0,0 +1,551 @@
|
|
1
|
+
# componentsDjangoType/management/commands/createcomponentApp.py
|
2
|
+
import os
|
3
|
+
from django.core.management.base import BaseCommand
|
4
|
+
from django.core.management import call_command
|
5
|
+
|
6
|
+
|
7
|
+
class Command(BaseCommand):
|
8
|
+
help = 'Crea una aplicación llamada Home, estructura de carpetas y configura urls automáticamente en el proyecto especificado'
|
9
|
+
|
10
|
+
def handle(self, *args, **kwargs):
|
11
|
+
# Nombre de la aplicación a crear
|
12
|
+
app_name = "Home"
|
13
|
+
|
14
|
+
# Paso 1: Solicitar el nombre de la aplicación principal al usuario
|
15
|
+
project_name = input(
|
16
|
+
"Por favor, ingresa el nombre de la aplicación principal del proyecto: ")
|
17
|
+
|
18
|
+
# Paso 2: Crear la aplicación "Home" si no existe
|
19
|
+
if not os.path.exists(app_name):
|
20
|
+
self.stdout.write(f"Creando la aplicación '{app_name}'...")
|
21
|
+
call_command('startapp', app_name)
|
22
|
+
else:
|
23
|
+
self.stdout.write(f"La aplicación '{app_name}' ya existe.")
|
24
|
+
|
25
|
+
# Paso 3: Crear el archivo urls.py en la aplicación "Home" si no existe
|
26
|
+
urls_path = os.path.join(app_name, 'urls.py')
|
27
|
+
if not os.path.exists(urls_path):
|
28
|
+
self.stdout.write(f"Creando el archivo '{urls_path}'...")
|
29
|
+
with open(urls_path, 'w') as f:
|
30
|
+
f.write(
|
31
|
+
"from django.urls import path\n\n"
|
32
|
+
"urlpatterns = [\n"
|
33
|
+
" # Añade tus rutas aquí\n"
|
34
|
+
"]\n"
|
35
|
+
)
|
36
|
+
else:
|
37
|
+
self.stdout.write(f"El archivo '{urls_path}' ya existe.")
|
38
|
+
|
39
|
+
# Paso 4: Modificar el archivo urls.py principal del proyecto
|
40
|
+
project_urls_path = os.path.join(project_name, 'urls.py')
|
41
|
+
if os.path.exists(project_urls_path):
|
42
|
+
with open(project_urls_path, 'r') as f:
|
43
|
+
content = f.read()
|
44
|
+
|
45
|
+
include_statement = "path('', include('Home.urls'))"
|
46
|
+
if include_statement not in content:
|
47
|
+
self.stdout.write(f"Añadiendo la ruta '{
|
48
|
+
include_statement}' al archivo urls.py principal...")
|
49
|
+
with open(project_urls_path, 'a') as f:
|
50
|
+
f.write(
|
51
|
+
"\nfrom django.urls import include, path\n\n"
|
52
|
+
"urlpatterns += [\n"
|
53
|
+
f" {include_statement},\n"
|
54
|
+
"]\n"
|
55
|
+
)
|
56
|
+
else:
|
57
|
+
self.stdout.write(
|
58
|
+
"La ruta ya existe en el archivo urls.py principal.")
|
59
|
+
else:
|
60
|
+
self.stdout.write(f"No se encontró el archivo principal urls.py en '{
|
61
|
+
project_urls_path}'. Asegúrate de que el nombre del proyecto sea correcto.")
|
62
|
+
|
63
|
+
# Paso 5: Crear la carpeta services y el archivo authentication.py en Home
|
64
|
+
services_dir = os.path.join(app_name, 'services')
|
65
|
+
# Crea la carpeta si no existe
|
66
|
+
os.makedirs(services_dir, exist_ok=True)
|
67
|
+
authentication_file_path = os.path.join(
|
68
|
+
services_dir, 'authentication.py')
|
69
|
+
|
70
|
+
if not os.path.exists(authentication_file_path):
|
71
|
+
self.stdout.write(f"Creando el archivo '{
|
72
|
+
authentication_file_path}'...")
|
73
|
+
with open(authentication_file_path, 'w') as f:
|
74
|
+
f.write(
|
75
|
+
"from django.shortcuts import render, redirect\n"
|
76
|
+
"from django.contrib.auth.forms import UserCreationForm, AuthenticationForm\n"
|
77
|
+
"from django.contrib.auth.models import User\n"
|
78
|
+
"from django.contrib.auth import login, logout, authenticate\n"
|
79
|
+
"from django.db import IntegrityError\n\n\n"
|
80
|
+
"class Authentication:\n"
|
81
|
+
" @staticmethod\n"
|
82
|
+
" def get_signup(request):\n"
|
83
|
+
" if request.method == 'GET':\n"
|
84
|
+
" return render(request, 'singup.html', {\n"
|
85
|
+
" 'form': UserCreationForm()\n"
|
86
|
+
" })\n"
|
87
|
+
" elif request.method == 'POST':\n"
|
88
|
+
" if request.POST['password1'] == request.POST['password2']:\n"
|
89
|
+
" try:\n"
|
90
|
+
" # Register user\n"
|
91
|
+
" user = User.objects.create_user(\n"
|
92
|
+
" username=request.POST['username'], password=request.POST['password2'])\n"
|
93
|
+
" user.save()\n"
|
94
|
+
" login(request, user)\n"
|
95
|
+
" return redirect('logged')\n"
|
96
|
+
" except IntegrityError:\n"
|
97
|
+
" return render(request, 'singup.html', {\n"
|
98
|
+
" 'form': UserCreationForm(),\n"
|
99
|
+
" 'error': 'User already exists'\n"
|
100
|
+
" })\n"
|
101
|
+
" return render(request, 'singup.html', {\n"
|
102
|
+
" 'form': UserCreationForm(),\n"
|
103
|
+
" 'error': 'Passwords do not match'\n"
|
104
|
+
" })\n\n"
|
105
|
+
" @staticmethod\n"
|
106
|
+
" def get_signout(request):\n"
|
107
|
+
" logout(request)\n"
|
108
|
+
" return redirect('home')\n\n"
|
109
|
+
" @staticmethod\n"
|
110
|
+
" def get_signing(request):\n"
|
111
|
+
" if request.method == 'GET':\n"
|
112
|
+
" return render(request, 'login.html', {\n"
|
113
|
+
" 'form': AuthenticationForm,\n"
|
114
|
+
" })\n"
|
115
|
+
" elif request.method == 'POST':\n"
|
116
|
+
" try:\n"
|
117
|
+
" User.objects.get(username=request.POST['username'])\n"
|
118
|
+
" except User.DoesNotExist:\n"
|
119
|
+
" return render(request, 'login.html', {\n"
|
120
|
+
" 'form': AuthenticationForm,\n"
|
121
|
+
" 'error': 'User does not exist in the database'\n"
|
122
|
+
" })\n"
|
123
|
+
" user = authenticate(\n"
|
124
|
+
" request, username=request.POST['username'], password=request.POST['password'])\n"
|
125
|
+
" if user is None:\n"
|
126
|
+
" return render(request, 'login.html', {\n"
|
127
|
+
" 'form': AuthenticationForm,\n"
|
128
|
+
" 'error': 'username or password is incorrect'\n"
|
129
|
+
" })\n"
|
130
|
+
" else:\n"
|
131
|
+
" login(request, user)\n"
|
132
|
+
" return redirect('logged')\n\n"
|
133
|
+
" @staticmethod\n"
|
134
|
+
" def get_logged(request):\n"
|
135
|
+
" return render(request, 'logged.html')\n\n"
|
136
|
+
" def dispatch(self, request, *args, **kwargs):\n"
|
137
|
+
" match request.path:\n"
|
138
|
+
" case \"/signup\":\n"
|
139
|
+
" return self.get_signup(request)\n"
|
140
|
+
" case \"/login\":\n"
|
141
|
+
" return self.get_signing(request)\n"
|
142
|
+
" case \"/logout\":\n"
|
143
|
+
" return self.get_signout(request)\n"
|
144
|
+
" case \"/logged\":\n"
|
145
|
+
" return self.get_logged(request)\n"
|
146
|
+
" case \"/\":\n"
|
147
|
+
" return self.get(request)\n"
|
148
|
+
" case _:\n"
|
149
|
+
" return self.get(request)\n"
|
150
|
+
)
|
151
|
+
else:
|
152
|
+
self.stdout.write(
|
153
|
+
f"El archivo '{authentication_file_path}' ya existe.")
|
154
|
+
|
155
|
+
# Paso 6: Crear la carpeta templates y estatic y los archivos HTML CSS y JS
|
156
|
+
templates_dir = os.path.join(app_name, 'templates')
|
157
|
+
static_dir = os.path.join(app_name, 'static')
|
158
|
+
|
159
|
+
# creacion de sub carpetas
|
160
|
+
layouts_dir = os.path.join(templates_dir, 'layouts')
|
161
|
+
js_dir = os.path.join(static_dir, 'js')
|
162
|
+
css_dir = os.path.join(static_dir, 'css')
|
163
|
+
|
164
|
+
# Crear las carpetas principales y subcarpetas
|
165
|
+
os.makedirs(templates_dir, exist_ok=True)
|
166
|
+
os.makedirs(static_dir, exist_ok=True)
|
167
|
+
os.makedirs(layouts_dir, exist_ok=True)
|
168
|
+
os.makedirs(js_dir, exist_ok=True)
|
169
|
+
os.makedirs(css_dir, exist_ok=True)
|
170
|
+
|
171
|
+
# creacion de los archivos
|
172
|
+
|
173
|
+
js_file_path = os.path.join(js_dir, 'alertErrors.js')
|
174
|
+
|
175
|
+
css_file_path = os.path.join(css_dir, 'authentication.css')
|
176
|
+
|
177
|
+
layout_files_path = os.path.join(layouts_dir, 'index.html')
|
178
|
+
|
179
|
+
template_files = {
|
180
|
+
'home.html': """{% extends "layouts/index.html" %}\n
|
181
|
+
{% block layout %}
|
182
|
+
{% endblock %}""",
|
183
|
+
'signup.html': """{% extends "layouts/index.html" %}
|
184
|
+
{% block layout %}
|
185
|
+
{% if error %}
|
186
|
+
<div class="alert" id="alert">
|
187
|
+
<div class="alert-content">
|
188
|
+
{{ error }}
|
189
|
+
<button class="close-btn" onclick="closeAlert()">
|
190
|
+
<span class="sr-only">Close</span>
|
191
|
+
<svg class="close-icon" width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
192
|
+
<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"/>
|
193
|
+
</svg>
|
194
|
+
</button>
|
195
|
+
</div>
|
196
|
+
</div>
|
197
|
+
{% endif %}\n
|
198
|
+
<div class="form-wrapper">
|
199
|
+
<div class="form-container">
|
200
|
+
<form action="" method="post" class="form-control">
|
201
|
+
{% csrf_token %}
|
202
|
+
<h1>sing up</h1>
|
203
|
+
|
204
|
+
<label for="username">Usuario:</label>
|
205
|
+
{{ form.username }}
|
206
|
+
|
207
|
+
<label for="password1">Contraseña:</label>
|
208
|
+
{{ form.password1 }}
|
209
|
+
|
210
|
+
<label for="password2">Confirmar Contraseña:</label>
|
211
|
+
{{ form.password2 }}
|
212
|
+
|
213
|
+
<button type="submit">sing Up</button>
|
214
|
+
</form>
|
215
|
+
</div>
|
216
|
+
</div>
|
217
|
+
{% endblock %}
|
218
|
+
{% block script %}
|
219
|
+
<script src="{% static 'js/alertErrors.js'%}"></script>
|
220
|
+
{% endblock %}""",
|
221
|
+
'login.html': """{% extends "layouts/index.html" %}
|
222
|
+
{% block layout %}
|
223
|
+
{% if error %}
|
224
|
+
<div class="alert" id="alert">
|
225
|
+
<div class="alert-content">
|
226
|
+
{{ error }}
|
227
|
+
<button class="close-btn" onclick="closeAlert()">
|
228
|
+
<span class="sr-only">Close</span>
|
229
|
+
<svg class="close-icon" width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
230
|
+
<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"/>
|
231
|
+
</svg>
|
232
|
+
</button>
|
233
|
+
</div>
|
234
|
+
</div>
|
235
|
+
{% endif %}
|
236
|
+
<div class="form-wrapper">
|
237
|
+
<div class="form-container">
|
238
|
+
<form action="" method="post" class="form-control">
|
239
|
+
{% csrf_token %}
|
240
|
+
<h1>Login</h1>
|
241
|
+
|
242
|
+
<label for="username">Usuario:</label>
|
243
|
+
{{ form.username }}
|
244
|
+
|
245
|
+
<label for="password">Contraseña:</label>
|
246
|
+
<input type="password" id="password" name="password" value="{{ form.password2 }}" required>
|
247
|
+
|
248
|
+
<button type="submit">Login</button>
|
249
|
+
</form>
|
250
|
+
</div>
|
251
|
+
</div>
|
252
|
+
{% endblock %}
|
253
|
+
{% block script %}
|
254
|
+
<script src="{% static 'js/alertErrors.js'%}"></script>
|
255
|
+
{% endblock %}""",
|
256
|
+
'logged.html': """{% extends "layouts/index.html" %}
|
257
|
+
{% block layout %}
|
258
|
+
<div class="layout-container">
|
259
|
+
<h1>¡Has iniciado sesión!</h1>
|
260
|
+
</div>
|
261
|
+
{% endblock %}"""
|
262
|
+
}
|
263
|
+
for template_file, content in template_files.items():
|
264
|
+
template_file_path = os.path.join(templates_dir, template_file)
|
265
|
+
|
266
|
+
# escritura de los archivos
|
267
|
+
|
268
|
+
# definiendoerrores
|
269
|
+
|
270
|
+
def write_file(file_path, content):
|
271
|
+
try:
|
272
|
+
with open(file_path, 'w') as file:
|
273
|
+
file.write(content)
|
274
|
+
print(f"Archivo escrito correctamente: {file_path}")
|
275
|
+
except Exception as e:
|
276
|
+
print(f"Error al escribir el archivo {file_path}: {e}")
|
277
|
+
|
278
|
+
# escritura del archivos js
|
279
|
+
write_file(js_file_path, """
|
280
|
+
function closeAlert() {
|
281
|
+
const alert = document.getElementById('alert');
|
282
|
+
if (alert) {
|
283
|
+
alert.remove();
|
284
|
+
}
|
285
|
+
}
|
286
|
+
""")
|
287
|
+
|
288
|
+
# escritura del archivo css
|
289
|
+
write_file(css_file_path, """
|
290
|
+
/* Navbar */
|
291
|
+
.navbar {
|
292
|
+
display: flex;
|
293
|
+
justify-content: space-between;
|
294
|
+
align-items: center;
|
295
|
+
padding: 10px 20px;
|
296
|
+
background-color: #333; /* Color de fondo */
|
297
|
+
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
|
298
|
+
}
|
299
|
+
|
300
|
+
/* Logo */
|
301
|
+
.navbar .logo a {
|
302
|
+
color: #ffffff;
|
303
|
+
font-size: 1.5em;
|
304
|
+
text-decoration: none;
|
305
|
+
transition: color 0.3s ease;
|
306
|
+
}
|
307
|
+
|
308
|
+
.navbar .logo a:hover {
|
309
|
+
color: #4a90e2; /* Hover del logo */
|
310
|
+
}
|
311
|
+
|
312
|
+
/* Links de navegación */
|
313
|
+
.nav-links {
|
314
|
+
display: flex;
|
315
|
+
gap: 15px;
|
316
|
+
list-style: none;
|
317
|
+
margin: 0;
|
318
|
+
padding: 0;
|
319
|
+
}
|
320
|
+
|
321
|
+
.nav-links .nav-item {
|
322
|
+
color: #ffffff;
|
323
|
+
font-size: 1em;
|
324
|
+
text-decoration: none;
|
325
|
+
padding: 8px 15px;
|
326
|
+
border-radius: 5px;
|
327
|
+
transition: background-color 0.3s ease, color 0.3s ease;
|
328
|
+
}
|
329
|
+
|
330
|
+
.nav-links .nav-item:hover {
|
331
|
+
background-color: #4a90e2; /* Hover */
|
332
|
+
color: #ffffff;
|
333
|
+
}
|
334
|
+
|
335
|
+
/* Estilos para dispositivos móviles */
|
336
|
+
.menu-toggle {
|
337
|
+
display: none;
|
338
|
+
}
|
339
|
+
|
340
|
+
@media (max-width: 768px) {
|
341
|
+
.menu-toggle {
|
342
|
+
display: inline-block;
|
343
|
+
font-size: 1.5em;
|
344
|
+
color: #ffffff;
|
345
|
+
cursor: pointer;
|
346
|
+
padding: 8px 15px;
|
347
|
+
}
|
348
|
+
|
349
|
+
.nav-links {
|
350
|
+
flex-direction: column;
|
351
|
+
position: absolute;
|
352
|
+
top: 100%;
|
353
|
+
right: 0;
|
354
|
+
width: 100%;
|
355
|
+
background-color: #333;
|
356
|
+
max-height: 0;
|
357
|
+
overflow: hidden;
|
358
|
+
transition: max-height 0.3s ease;
|
359
|
+
}
|
360
|
+
|
361
|
+
/* Activar menú desplegable */
|
362
|
+
.nav-links.active {
|
363
|
+
max-height: 300px; /* Ajustar altura */
|
364
|
+
}
|
365
|
+
|
366
|
+
.nav-links .nav-item {
|
367
|
+
padding: 10px 20px;
|
368
|
+
}
|
369
|
+
}
|
370
|
+
|
371
|
+
/* formularios */
|
372
|
+
/* Contenedor para centrar el formulario */
|
373
|
+
.form-wrapper {
|
374
|
+
display: flex;
|
375
|
+
justify-content: center;
|
376
|
+
align-items: center;
|
377
|
+
margin-top: 50px;
|
378
|
+
}
|
379
|
+
|
380
|
+
/* Contenedor del formulario */
|
381
|
+
.form-container {
|
382
|
+
padding: 20px;
|
383
|
+
background: black; /* Fondo azul con transparencia */
|
384
|
+
border-radius: 8px;
|
385
|
+
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
|
386
|
+
color: white;
|
387
|
+
text-align: center;
|
388
|
+
max-width: 400px;
|
389
|
+
width: 100%;
|
390
|
+
}
|
391
|
+
|
392
|
+
/* Estilo del formulario */
|
393
|
+
.form-control {
|
394
|
+
display: flex;
|
395
|
+
flex-direction: column;
|
396
|
+
gap: 15px;
|
397
|
+
}
|
398
|
+
|
399
|
+
/* Estilo para las etiquetas */
|
400
|
+
label {
|
401
|
+
font-size: 0.9em;
|
402
|
+
color: #d1d5db; /* Color gris claro */
|
403
|
+
margin-bottom: 5px;
|
404
|
+
text-align: left;
|
405
|
+
}
|
406
|
+
|
407
|
+
/* Estilo para los campos de entrada */
|
408
|
+
input[type="text"],
|
409
|
+
input[type="password"] {
|
410
|
+
padding: 10px;
|
411
|
+
background: rgba(255, 255, 255, 0.2);
|
412
|
+
border: 1px solid rgba(255, 255, 255, 0.3);
|
413
|
+
border-radius: 5px;
|
414
|
+
color: #ffffff;
|
415
|
+
outline: none;
|
416
|
+
font-size: 1em;
|
417
|
+
transition: background 0.3s ease, box-shadow 0.3s ease;
|
418
|
+
}
|
419
|
+
|
420
|
+
input[type="text"]:focus,
|
421
|
+
input[type="password"]:focus {
|
422
|
+
background: rgba(255, 255, 255, 0.4);
|
423
|
+
box-shadow: 0 0 5px rgba(255, 255, 255, 0.5);
|
424
|
+
}
|
425
|
+
|
426
|
+
/* Estilo del botón */
|
427
|
+
button[type="submit"] {
|
428
|
+
padding: 10px;
|
429
|
+
background: #4a90e2;
|
430
|
+
color: white;
|
431
|
+
border: none;
|
432
|
+
border-radius: 5px;
|
433
|
+
cursor: pointer;
|
434
|
+
transition: background 0.3s ease;
|
435
|
+
}
|
436
|
+
|
437
|
+
button[type="submit"]:hover {
|
438
|
+
background: #357ab8;
|
439
|
+
}
|
440
|
+
|
441
|
+
/* alert */
|
442
|
+
|
443
|
+
/* Estilos para la alerta */
|
444
|
+
.alert {
|
445
|
+
max-width: 400px;
|
446
|
+
background-color: #333;
|
447
|
+
color: #ffffff;
|
448
|
+
border-radius: 8px;
|
449
|
+
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
|
450
|
+
margin: 0 auto;
|
451
|
+
position: relative;
|
452
|
+
top: 20px;
|
453
|
+
padding: 15px;
|
454
|
+
}
|
455
|
+
|
456
|
+
.alert-content {
|
457
|
+
display: flex;
|
458
|
+
justify-content: space-between;
|
459
|
+
align-items: center;
|
460
|
+
}
|
461
|
+
|
462
|
+
.close-btn {
|
463
|
+
background: none;
|
464
|
+
border: none;
|
465
|
+
cursor: pointer;
|
466
|
+
color: #ffffff;
|
467
|
+
transition: color 0.3s ease;
|
468
|
+
}
|
469
|
+
|
470
|
+
.close-btn:hover {
|
471
|
+
color: #ff6b6b;
|
472
|
+
}
|
473
|
+
|
474
|
+
.close-icon {
|
475
|
+
width: 16px;
|
476
|
+
height: 16px;
|
477
|
+
}
|
478
|
+
|
479
|
+
/* logged */
|
480
|
+
|
481
|
+
/* Estilos para el contenedor del bloque */
|
482
|
+
.layout-container {
|
483
|
+
display: flex;
|
484
|
+
justify-content: center;
|
485
|
+
align-items: center;
|
486
|
+
height: 100vh;
|
487
|
+
background-color: #f0f4f8;
|
488
|
+
font-family: Arial, sans-serif;
|
489
|
+
}
|
490
|
+
|
491
|
+
/* Estilos para el título */
|
492
|
+
.layout-container h1 {
|
493
|
+
font-size: 2.5rem;
|
494
|
+
color: #4a90e2;
|
495
|
+
font-weight: bold;
|
496
|
+
text-align: center;
|
497
|
+
padding: 20px;
|
498
|
+
border-radius: 8px;
|
499
|
+
background: #ffffff;
|
500
|
+
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
|
501
|
+
}
|
502
|
+
""")
|
503
|
+
# escritura del archivos que estan en la carpeta layouts
|
504
|
+
write_file(layout_files_path, """
|
505
|
+
{% load static %}
|
506
|
+
<!DOCTYPE html>
|
507
|
+
<html lang="en">
|
508
|
+
<head>
|
509
|
+
<meta charset="UTF-8">
|
510
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
511
|
+
<link rel="stylesheet" href="{% static 'css/authentication.css' %}">
|
512
|
+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.6.0/css/all.min.css">
|
513
|
+
<title>django components</title>
|
514
|
+
</head>
|
515
|
+
<body class="bg-gray-100 text-gray-800">
|
516
|
+
|
517
|
+
<nav class="navbar">
|
518
|
+
<div class="logo">
|
519
|
+
<a href="{% url 'home' %}">
|
520
|
+
<i class="fa-solid fa-house"></i>
|
521
|
+
</a>
|
522
|
+
</div>
|
523
|
+
<div class="menu-toggle">
|
524
|
+
<i class="fa fa-bars"></i>
|
525
|
+
</div>
|
526
|
+
<ul class="nav-links">
|
527
|
+
{% if user.is_authenticated %}
|
528
|
+
<li><a href="{% url 'logout' %}" class="nav-item">Logout</a></li>
|
529
|
+
{% else %}
|
530
|
+
<li><a href="{% url 'signup' %}" class="nav-item">Sign Up</a></li>
|
531
|
+
<li><a href="{% url 'login' %}" class="nav-item">Login</a></li>
|
532
|
+
{% endif %}
|
533
|
+
</ul>
|
534
|
+
</nav>
|
535
|
+
|
536
|
+
<div class="container mx-auto p-4">
|
537
|
+
{% block layout %}
|
538
|
+
{% endblock %}
|
539
|
+
</div>
|
540
|
+
|
541
|
+
{% block script %}
|
542
|
+
{% endblock %}
|
543
|
+
</body>
|
544
|
+
</html>
|
545
|
+
""")
|
546
|
+
|
547
|
+
# escritura de los archivoos html
|
548
|
+
write_file(template_file_path, content)
|
549
|
+
|
550
|
+
self.stdout.write(self.style.SUCCESS(
|
551
|
+
"Comando ejecutado exitosamente."))
|
@@ -0,0 +1,14 @@
|
|
1
|
+
LICENSE
|
2
|
+
MANIFEST.in
|
3
|
+
README.md
|
4
|
+
setup.py
|
5
|
+
componentsDjangoType/__init__.py
|
6
|
+
componentsDjangoType.egg-info/PKG-INFO
|
7
|
+
componentsDjangoType.egg-info/SOURCES.txt
|
8
|
+
componentsDjangoType.egg-info/dependency_links.txt
|
9
|
+
componentsDjangoType.egg-info/requires.txt
|
10
|
+
componentsDjangoType.egg-info/top_level.txt
|
11
|
+
componentsDjangoType/management/__init__.py
|
12
|
+
componentsDjangoType/management/commands/__init__.py
|
13
|
+
componentsDjangoType/management/commands/createApp.py
|
14
|
+
componentsDjangoType/management/commands/createcomponent.py
|
@@ -2,12 +2,9 @@ from setuptools import setup, find_packages
|
|
2
2
|
|
3
3
|
setup(
|
4
4
|
name='componentsDjangoType',
|
5
|
-
version='1.0.
|
5
|
+
version='1.0.5',
|
6
6
|
packages=find_packages(),
|
7
7
|
include_package_data=True,
|
8
|
-
package_data={
|
9
|
-
'componentsDjangoType.utils': ['css/*.css', 'js/*.js', 'layouts/*.html', 'pages/*.html']
|
10
|
-
},
|
11
8
|
license='MIT',
|
12
9
|
description='A Django app for creating HTML components',
|
13
10
|
long_description=open('README.md').read(),
|
@@ -1,256 +0,0 @@
|
|
1
|
-
import os
|
2
|
-
from django.core.management.base import BaseCommand
|
3
|
-
from django.core.management import call_command
|
4
|
-
import componentsDjangoType.management.commands.utils as utils
|
5
|
-
|
6
|
-
|
7
|
-
class Command(BaseCommand):
|
8
|
-
help = 'Crea una aplicación llamada Home, estructura de carpetas y configura urls automáticamente en el proyecto especificado'
|
9
|
-
|
10
|
-
def handle(self, *args, **kwargs):
|
11
|
-
# Nombre de la aplicación a crear
|
12
|
-
app_name = "Home"
|
13
|
-
|
14
|
-
# Paso 1: Solicitar el nombre de la aplicación principal al usuario
|
15
|
-
project_name = input(
|
16
|
-
"Por favor, ingresa el nombre de la aplicación principal del proyecto: ")
|
17
|
-
|
18
|
-
# Paso 2: Crear la aplicación "Home" si no existe
|
19
|
-
if not os.path.exists(app_name):
|
20
|
-
self.stdout.write(f"Creando la aplicación '{app_name}'...")
|
21
|
-
call_command('startapp', app_name)
|
22
|
-
else:
|
23
|
-
self.stdout.write(f"La aplicación '{app_name}' ya existe.")
|
24
|
-
|
25
|
-
# Paso 3: Crear el archivo urls.py en la aplicación "Home" si no existe
|
26
|
-
urls_path = os.path.join(app_name, 'urls.py')
|
27
|
-
if not os.path.exists(urls_path):
|
28
|
-
self.stdout.write(f"Creando el archivo '{urls_path}'...")
|
29
|
-
with open(urls_path, 'w') as f:
|
30
|
-
f.write(
|
31
|
-
"from django.urls import path\n\n"
|
32
|
-
"urlpatterns = [\n"
|
33
|
-
" # Añade tus rutas aquí\n"
|
34
|
-
"]\n"
|
35
|
-
)
|
36
|
-
else:
|
37
|
-
self.stdout.write(f"El archivo '{urls_path}' ya existe.")
|
38
|
-
|
39
|
-
# Paso 4: Modificar el archivo urls.py principal del proyecto
|
40
|
-
project_urls_path = os.path.join(
|
41
|
-
project_name, 'urls.py')
|
42
|
-
if os.path.exists(project_urls_path):
|
43
|
-
with open(project_urls_path, 'r') as f:
|
44
|
-
content = f.read()
|
45
|
-
|
46
|
-
include_statement = "path('', include('Home.urls'))"
|
47
|
-
if include_statement not in content:
|
48
|
-
self.stdout.write(f"Añadiendo la ruta '{
|
49
|
-
include_statement}' al archivo urls.py principal...")
|
50
|
-
with open(project_urls_path, 'a') as f:
|
51
|
-
f.write(
|
52
|
-
"\nfrom django.urls import include, path\n\n"
|
53
|
-
"urlpatterns += [\n"
|
54
|
-
f" {include_statement},\n"
|
55
|
-
"]\n"
|
56
|
-
)
|
57
|
-
else:
|
58
|
-
self.stdout.write(
|
59
|
-
"La ruta ya existe en el archivo urls.py principal.")
|
60
|
-
else:
|
61
|
-
self.stdout.write(f"No se encontró el archivo principal urls.py en '{
|
62
|
-
project_urls_path}'. Asegúrate de que el nombre del proyecto sea correcto.")
|
63
|
-
|
64
|
-
# Paso 5: Crear la carpeta services y el archivo authentication.py en Home
|
65
|
-
services_dir = os.path.join(app_name, 'services')
|
66
|
-
# Crea la carpeta si no existe
|
67
|
-
os.makedirs(services_dir, exist_ok=True)
|
68
|
-
authentication_file_path = os.path.join(
|
69
|
-
services_dir, 'authentication.py')
|
70
|
-
|
71
|
-
if not os.path.exists(authentication_file_path):
|
72
|
-
self.stdout.write(f"Creando el archivo '{
|
73
|
-
authentication_file_path}'...")
|
74
|
-
with open(authentication_file_path, 'w') as f:
|
75
|
-
f.write(
|
76
|
-
"from django.shortcuts import render, redirect\n"
|
77
|
-
"from django.contrib.auth.forms import UserCreationForm, AuthenticationForm\n"
|
78
|
-
"from django.contrib.auth.models import User\n"
|
79
|
-
"from django.contrib.auth import login, logout, authenticate\n"
|
80
|
-
"from django.db import IntegrityError\n\n\n"
|
81
|
-
"class Authentication:\n"
|
82
|
-
" @staticmethod\n"
|
83
|
-
" def get_signup(request):\n"
|
84
|
-
" if request.method == 'GET':\n"
|
85
|
-
" return render(request, 'singup.html', {\n"
|
86
|
-
" 'form': UserCreationForm()\n"
|
87
|
-
" })\n"
|
88
|
-
" elif request.method == 'POST':\n"
|
89
|
-
" if request.POST['password1'] == request.POST['password2']:\n"
|
90
|
-
" try:\n"
|
91
|
-
" # Register user\n"
|
92
|
-
" user = User.objects.create_user(\n"
|
93
|
-
" username=request.POST['username'], password=request.POST['password2'])\n"
|
94
|
-
" user.save()\n"
|
95
|
-
" login(request, user)\n"
|
96
|
-
" return redirect('logged')\n"
|
97
|
-
" except IntegrityError:\n"
|
98
|
-
" return render(request, 'singup.html', {\n"
|
99
|
-
" 'form': UserCreationForm(),\n"
|
100
|
-
" 'error': 'User already exists'\n"
|
101
|
-
" })\n"
|
102
|
-
" return render(request, 'singup.html', {\n"
|
103
|
-
" 'form': UserCreationForm(),\n"
|
104
|
-
" 'error': 'Passwords do not match'\n"
|
105
|
-
" })\n\n"
|
106
|
-
" @staticmethod\n"
|
107
|
-
" def get_signout(request):\n"
|
108
|
-
" logout(request)\n"
|
109
|
-
" return redirect('home')\n\n"
|
110
|
-
" @staticmethod\n"
|
111
|
-
" def get_signing(request):\n"
|
112
|
-
" if request.method == 'GET':\n"
|
113
|
-
" return render(request, 'login.html', {\n"
|
114
|
-
" 'form': AuthenticationForm,\n"
|
115
|
-
" })\n"
|
116
|
-
" elif request.method == 'POST':\n"
|
117
|
-
" try:\n"
|
118
|
-
" User.objects.get(username=request.POST['username'])\n"
|
119
|
-
" except User.DoesNotExist:\n"
|
120
|
-
" return render(request, 'login.html', {\n"
|
121
|
-
" 'form': AuthenticationForm,\n"
|
122
|
-
" 'error': 'User does not exist in the database'\n"
|
123
|
-
" })\n"
|
124
|
-
" user = authenticate(\n"
|
125
|
-
" request, username=request.POST['username'], password=request.POST['password'])\n"
|
126
|
-
" if user is None:\n"
|
127
|
-
" return render(request, 'login.html', {\n"
|
128
|
-
" 'form': AuthenticationForm,\n"
|
129
|
-
" 'error': 'username or password is incorrect'\n"
|
130
|
-
" })\n"
|
131
|
-
" else:\n"
|
132
|
-
" login(request, user)\n"
|
133
|
-
" return redirect('logged')\n\n"
|
134
|
-
" @staticmethod\n"
|
135
|
-
" def get_logged(request):\n"
|
136
|
-
" return render(request, 'logged.html')\n\n"
|
137
|
-
" def dispatch(self, request, *args, **kwargs):\n"
|
138
|
-
" match request.path:\n"
|
139
|
-
" case \"/signup\":\n"
|
140
|
-
" return self.get_signup(request)\n"
|
141
|
-
" case \"/login\":\n"
|
142
|
-
" return self.get_signing(request)\n"
|
143
|
-
" case \"/logout\":\n"
|
144
|
-
" return self.get_signout(request)\n"
|
145
|
-
" case \"/logged\":\n"
|
146
|
-
" return self.get_logged(request)\n"
|
147
|
-
" case \"/\":\n"
|
148
|
-
" return self.get(request)\n"
|
149
|
-
" case _:\n"
|
150
|
-
" return self.get(request)\n"
|
151
|
-
)
|
152
|
-
else:
|
153
|
-
self.stdout.write(
|
154
|
-
f"El archivo '{authentication_file_path}' ya existe.")
|
155
|
-
|
156
|
-
# Paso 6: Crear la carpeta templates y los archivos HTML
|
157
|
-
# Asumiendo que `project_name` ya está definido
|
158
|
-
templates_dir = os.path.join(project_name, 'templates')
|
159
|
-
layouts_dir = os.path.join(templates_dir, 'layouts')
|
160
|
-
static_dir = os.path.join(project_name, 'static')
|
161
|
-
css_dir = os.path.join(static_dir, 'css')
|
162
|
-
js_dir = os.path.join(static_dir, 'js')
|
163
|
-
|
164
|
-
# Ruta base para `utils`
|
165
|
-
utils_base_path = os.path.dirname(utils.__file__)
|
166
|
-
|
167
|
-
# Crear los directorios necesarios
|
168
|
-
os.makedirs(js_dir, exist_ok=True)
|
169
|
-
os.makedirs(css_dir, exist_ok=True)
|
170
|
-
os.makedirs(layouts_dir, exist_ok=True)
|
171
|
-
os.makedirs(templates_dir, exist_ok=True)
|
172
|
-
os.makedirs(static_dir, exist_ok=True)
|
173
|
-
|
174
|
-
css_source_path = os.path.join(
|
175
|
-
utils_base_path, 'css', 'authentication.css')
|
176
|
-
js_source_path = os.path.join(utils_base_path, 'js', 'alertErrors.js')
|
177
|
-
index_page_source = os.path.join(
|
178
|
-
utils_base_path, 'layouts', 'index.html')
|
179
|
-
home_page = os.path.join(utils_base_path, 'pages', 'home.html')
|
180
|
-
signup_page = os.path.join(utils_base_path, 'pages', 'signup.html')
|
181
|
-
login_page = os.path.join(utils_base_path, 'pages', 'login.html')
|
182
|
-
logged_page = os.path.join(utils_base_path, 'pages', 'logged.html')
|
183
|
-
|
184
|
-
# Crear archivos si no existen
|
185
|
-
if not os.path.exists(css_source_path):
|
186
|
-
try:
|
187
|
-
with open(css_source_path, 'r') as source_file:
|
188
|
-
css_content = source_file.read()
|
189
|
-
with open(js_source_path, 'r') as source_file:
|
190
|
-
js_content = source_file.read()
|
191
|
-
|
192
|
-
with open(css_source_path, 'w') as f:
|
193
|
-
f.write(css_content)
|
194
|
-
with open(js_source_path, 'w') as f:
|
195
|
-
f.write(js_content)
|
196
|
-
|
197
|
-
print(f"Archivo CSS creado exitosamente en {
|
198
|
-
js_source_path}")
|
199
|
-
print(f"Archivo JS creado exitosamente en {js_source_path}")
|
200
|
-
except FileNotFoundError as e:
|
201
|
-
print(f"Archivo fuente no encontrado: {e}")
|
202
|
-
except Exception as e:
|
203
|
-
print(f"Error al crear el archivo: {e}")
|
204
|
-
|
205
|
-
# Crear el archivo de layout (index.html) si no existe
|
206
|
-
index_page_source = os.path.join('utils', 'layouts', 'index.html')
|
207
|
-
layouts_source = os.path.join(layouts_dir, 'index.html')
|
208
|
-
|
209
|
-
if not os.path.exists(layouts_source):
|
210
|
-
try:
|
211
|
-
with open(index_page_source, 'r') as source_file:
|
212
|
-
index_content = source_file.read()
|
213
|
-
|
214
|
-
with open(layouts_source, 'w') as f:
|
215
|
-
f.write(index_content)
|
216
|
-
|
217
|
-
print("Archivo de layout creado exitosamente")
|
218
|
-
except FileNotFoundError as e:
|
219
|
-
print(f"Archivo fuente no encontrado: {e}")
|
220
|
-
except Exception as e:
|
221
|
-
print(f"Error al crear el archivo: {e}")
|
222
|
-
|
223
|
-
# Crear las páginas HTML adicionales (home, signup, login, logged)
|
224
|
-
home_page = os.path.join('utils', 'pages', 'home.html')
|
225
|
-
signup_page = os.path.join('utils', 'pages', 'signup.html')
|
226
|
-
login_page = os.path.join('utils', 'pages', 'login.html')
|
227
|
-
logged_page = os.path.join('utils', 'pages', 'logged.html')
|
228
|
-
|
229
|
-
# Rutas de los archivos de destino
|
230
|
-
home_dest = os.path.join(templates_dir, 'home.html')
|
231
|
-
signup_dest = os.path.join(templates_dir, 'signup.html')
|
232
|
-
login_dest = os.path.join(templates_dir, 'login.html')
|
233
|
-
logged_dest = os.path.join(templates_dir, 'logged.html')
|
234
|
-
|
235
|
-
# Crear cada archivo HTML si no existe
|
236
|
-
for source_path, dest_path, page_name in [
|
237
|
-
(home_page, home_dest, 'Home'),
|
238
|
-
(signup_page, signup_dest, 'Signup'),
|
239
|
-
(login_page, login_dest, 'Login'),
|
240
|
-
(logged_page, logged_dest, 'Logged')
|
241
|
-
]:
|
242
|
-
if not os.path.exists(dest_path):
|
243
|
-
try:
|
244
|
-
with open(source_path, 'r') as source_file:
|
245
|
-
content = source_file.read()
|
246
|
-
with open(dest_path, 'w') as dest_file:
|
247
|
-
dest_file.write(content)
|
248
|
-
print(f"Archivo {page_name} creado exitosamente en {
|
249
|
-
dest_path}")
|
250
|
-
except FileNotFoundError as e:
|
251
|
-
print(f"Archivo fuente no encontrado: {source_path}")
|
252
|
-
except Exception as e:
|
253
|
-
print(f"Error al crear el archivo {page_name}: {e}")
|
254
|
-
|
255
|
-
self.stdout.write(self.style.SUCCESS(
|
256
|
-
"Comando ejecutado exitosamente."))
|
componentsdjangotype-1.0.4/componentsDjangoType/management/commands/utils/css/authentication.css
DELETED
@@ -1,212 +0,0 @@
|
|
1
|
-
/* Navbar */
|
2
|
-
.navbar {
|
3
|
-
display: flex;
|
4
|
-
justify-content: space-between;
|
5
|
-
align-items: center;
|
6
|
-
padding: 10px 20px;
|
7
|
-
background-color: #333; /* Color de fondo */
|
8
|
-
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
|
9
|
-
}
|
10
|
-
|
11
|
-
/* Logo */
|
12
|
-
.navbar .logo a {
|
13
|
-
color: #ffffff;
|
14
|
-
font-size: 1.5em;
|
15
|
-
text-decoration: none;
|
16
|
-
transition: color 0.3s ease;
|
17
|
-
}
|
18
|
-
|
19
|
-
.navbar .logo a:hover {
|
20
|
-
color: #4a90e2; /* Hover del logo */
|
21
|
-
}
|
22
|
-
|
23
|
-
/* Links de navegación */
|
24
|
-
.nav-links {
|
25
|
-
display: flex;
|
26
|
-
gap: 15px;
|
27
|
-
list-style: none;
|
28
|
-
margin: 0;
|
29
|
-
padding: 0;
|
30
|
-
}
|
31
|
-
|
32
|
-
.nav-links .nav-item {
|
33
|
-
color: #ffffff;
|
34
|
-
font-size: 1em;
|
35
|
-
text-decoration: none;
|
36
|
-
padding: 8px 15px;
|
37
|
-
border-radius: 5px;
|
38
|
-
transition: background-color 0.3s ease, color 0.3s ease;
|
39
|
-
}
|
40
|
-
|
41
|
-
.nav-links .nav-item:hover {
|
42
|
-
background-color: #4a90e2; /* Hover */
|
43
|
-
color: #ffffff;
|
44
|
-
}
|
45
|
-
|
46
|
-
/* Estilos para dispositivos móviles */
|
47
|
-
.menu-toggle {
|
48
|
-
display: none;
|
49
|
-
}
|
50
|
-
|
51
|
-
@media (max-width: 768px) {
|
52
|
-
.menu-toggle {
|
53
|
-
display: inline-block;
|
54
|
-
font-size: 1.5em;
|
55
|
-
color: #ffffff;
|
56
|
-
cursor: pointer;
|
57
|
-
padding: 8px 15px;
|
58
|
-
}
|
59
|
-
|
60
|
-
.nav-links {
|
61
|
-
flex-direction: column;
|
62
|
-
position: absolute;
|
63
|
-
top: 100%;
|
64
|
-
right: 0;
|
65
|
-
width: 100%;
|
66
|
-
background-color: #333;
|
67
|
-
max-height: 0;
|
68
|
-
overflow: hidden;
|
69
|
-
transition: max-height 0.3s ease;
|
70
|
-
}
|
71
|
-
|
72
|
-
/* Activar menú desplegable */
|
73
|
-
.nav-links.active {
|
74
|
-
max-height: 300px; /* Ajustar altura */
|
75
|
-
}
|
76
|
-
|
77
|
-
.nav-links .nav-item {
|
78
|
-
padding: 10px 20px;
|
79
|
-
}
|
80
|
-
}
|
81
|
-
|
82
|
-
/* formularios */
|
83
|
-
/* Contenedor para centrar el formulario */
|
84
|
-
.form-wrapper {
|
85
|
-
display: flex;
|
86
|
-
justify-content: center;
|
87
|
-
align-items: center;
|
88
|
-
margin-top: 50px;
|
89
|
-
}
|
90
|
-
|
91
|
-
/* Contenedor del formulario */
|
92
|
-
.form-container {
|
93
|
-
padding: 20px;
|
94
|
-
background: black; /* Fondo azul con transparencia */
|
95
|
-
border-radius: 8px;
|
96
|
-
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
|
97
|
-
color: white;
|
98
|
-
text-align: center;
|
99
|
-
max-width: 400px;
|
100
|
-
width: 100%;
|
101
|
-
}
|
102
|
-
|
103
|
-
/* Estilo del formulario */
|
104
|
-
.form-control {
|
105
|
-
display: flex;
|
106
|
-
flex-direction: column;
|
107
|
-
gap: 15px;
|
108
|
-
}
|
109
|
-
|
110
|
-
/* Estilo para las etiquetas */
|
111
|
-
label {
|
112
|
-
font-size: 0.9em;
|
113
|
-
color: #d1d5db; /* Color gris claro */
|
114
|
-
margin-bottom: 5px;
|
115
|
-
text-align: left;
|
116
|
-
}
|
117
|
-
|
118
|
-
/* Estilo para los campos de entrada */
|
119
|
-
input[type="text"],
|
120
|
-
input[type="password"] {
|
121
|
-
padding: 10px;
|
122
|
-
background: rgba(255, 255, 255, 0.2);
|
123
|
-
border: 1px solid rgba(255, 255, 255, 0.3);
|
124
|
-
border-radius: 5px;
|
125
|
-
color: #ffffff;
|
126
|
-
outline: none;
|
127
|
-
font-size: 1em;
|
128
|
-
transition: background 0.3s ease, box-shadow 0.3s ease;
|
129
|
-
}
|
130
|
-
|
131
|
-
input[type="text"]:focus,
|
132
|
-
input[type="password"]:focus {
|
133
|
-
background: rgba(255, 255, 255, 0.4);
|
134
|
-
box-shadow: 0 0 5px rgba(255, 255, 255, 0.5);
|
135
|
-
}
|
136
|
-
|
137
|
-
/* Estilo del botón */
|
138
|
-
button[type="submit"] {
|
139
|
-
padding: 10px;
|
140
|
-
background: #4a90e2;
|
141
|
-
color: white;
|
142
|
-
border: none;
|
143
|
-
border-radius: 5px;
|
144
|
-
cursor: pointer;
|
145
|
-
transition: background 0.3s ease;
|
146
|
-
}
|
147
|
-
|
148
|
-
button[type="submit"]:hover {
|
149
|
-
background: #357ab8;
|
150
|
-
}
|
151
|
-
|
152
|
-
/* alert */
|
153
|
-
|
154
|
-
/* Estilos para la alerta */
|
155
|
-
.alert {
|
156
|
-
max-width: 400px;
|
157
|
-
background-color: #333;
|
158
|
-
color: #ffffff;
|
159
|
-
border-radius: 8px;
|
160
|
-
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
|
161
|
-
margin: 0 auto;
|
162
|
-
position: relative;
|
163
|
-
top: 20px;
|
164
|
-
padding: 15px;
|
165
|
-
}
|
166
|
-
|
167
|
-
.alert-content {
|
168
|
-
display: flex;
|
169
|
-
justify-content: space-between;
|
170
|
-
align-items: center;
|
171
|
-
}
|
172
|
-
|
173
|
-
.close-btn {
|
174
|
-
background: none;
|
175
|
-
border: none;
|
176
|
-
cursor: pointer;
|
177
|
-
color: #ffffff;
|
178
|
-
transition: color 0.3s ease;
|
179
|
-
}
|
180
|
-
|
181
|
-
.close-btn:hover {
|
182
|
-
color: #ff6b6b;
|
183
|
-
}
|
184
|
-
|
185
|
-
.close-icon {
|
186
|
-
width: 16px;
|
187
|
-
height: 16px;
|
188
|
-
}
|
189
|
-
|
190
|
-
/* logged */
|
191
|
-
|
192
|
-
/* Estilos para el contenedor del bloque */
|
193
|
-
.layout-container {
|
194
|
-
display: flex;
|
195
|
-
justify-content: center;
|
196
|
-
align-items: center;
|
197
|
-
height: 100vh;
|
198
|
-
background-color: #f0f4f8;
|
199
|
-
font-family: Arial, sans-serif;
|
200
|
-
}
|
201
|
-
|
202
|
-
/* Estilos para el título */
|
203
|
-
.layout-container h1 {
|
204
|
-
font-size: 2.5rem;
|
205
|
-
color: #4a90e2;
|
206
|
-
font-weight: bold;
|
207
|
-
text-align: center;
|
208
|
-
padding: 20px;
|
209
|
-
border-radius: 8px;
|
210
|
-
background: #ffffff;
|
211
|
-
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
|
212
|
-
}
|
File without changes
|
componentsdjangotype-1.0.4/componentsDjangoType/management/commands/utils/layouts/index.html
DELETED
@@ -1,40 +0,0 @@
|
|
1
|
-
{% load static %}
|
2
|
-
<!DOCTYPE html>
|
3
|
-
<html lang="en">
|
4
|
-
<head>
|
5
|
-
<meta charset="UTF-8">
|
6
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
7
|
-
<link rel="stylesheet" href="{% static 'css/authentication.css' %}">
|
8
|
-
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.6.0/css/all.min.css">
|
9
|
-
<title>django components</title>
|
10
|
-
</head>
|
11
|
-
<body class="bg-gray-100 text-gray-800">
|
12
|
-
|
13
|
-
<nav class="navbar">
|
14
|
-
<div class="logo">
|
15
|
-
<a href="{% url 'home' %}">
|
16
|
-
<i class="fa-solid fa-house"></i>
|
17
|
-
</a>
|
18
|
-
</div>
|
19
|
-
<div class="menu-toggle">
|
20
|
-
<i class="fa fa-bars"></i>
|
21
|
-
</div>
|
22
|
-
<ul class="nav-links">
|
23
|
-
{% if user.is_authenticated %}
|
24
|
-
<li><a href="{% url 'logout' %}" class="nav-item">Logout</a></li>
|
25
|
-
{% else %}
|
26
|
-
<li><a href="{% url 'signup' %}" class="nav-item">Sign Up</a></li>
|
27
|
-
<li><a href="{% url 'login' %}" class="nav-item">Login</a></li>
|
28
|
-
{% endif %}
|
29
|
-
</ul>
|
30
|
-
</nav>
|
31
|
-
|
32
|
-
<div class="container mx-auto p-4">
|
33
|
-
{% block layout %}
|
34
|
-
{% endblock %}
|
35
|
-
</div>
|
36
|
-
|
37
|
-
{% block script %}
|
38
|
-
{% endblock %}
|
39
|
-
</body>
|
40
|
-
</html>
|
@@ -1,35 +0,0 @@
|
|
1
|
-
{% extends "layouts/index.html" %}
|
2
|
-
{% block layout %}
|
3
|
-
{% if error %}
|
4
|
-
<div class="alert" id="alert">
|
5
|
-
<div class="alert-content">
|
6
|
-
{{ error }}
|
7
|
-
<button class="close-btn" onclick="closeAlert()">
|
8
|
-
<span class="sr-only">Close</span>
|
9
|
-
<svg class="close-icon" width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
10
|
-
<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"/>
|
11
|
-
</svg>
|
12
|
-
</button>
|
13
|
-
</div>
|
14
|
-
</div>
|
15
|
-
{% endif %}
|
16
|
-
<div class="form-wrapper">
|
17
|
-
<div class="form-container">
|
18
|
-
<form action="" method="post" class="form-control">
|
19
|
-
{% csrf_token %}
|
20
|
-
<h1>Login</h1>
|
21
|
-
|
22
|
-
<label for="username">Usuario:</label>
|
23
|
-
{{ form.username }}
|
24
|
-
|
25
|
-
<label for="password">Contraseña:</label>
|
26
|
-
<input type="password" id="password" name="password" value="{{ form.password2 }}" required>
|
27
|
-
|
28
|
-
<button type="submit">Login</button>
|
29
|
-
</form>
|
30
|
-
</div>
|
31
|
-
</div>
|
32
|
-
{% endblock %}
|
33
|
-
{% block script %}
|
34
|
-
<script src="{% static 'js/alertErrors.js'%}"></script>
|
35
|
-
{% endblock %}
|
@@ -1,38 +0,0 @@
|
|
1
|
-
{% extends "layouts/index.html" %}
|
2
|
-
{% block layout %}
|
3
|
-
{% if error %}
|
4
|
-
<div class="alert" id="alert">
|
5
|
-
<div class="alert-content">
|
6
|
-
{{ error }}
|
7
|
-
<button class="close-btn" onclick="closeAlert()">
|
8
|
-
<span class="sr-only">Close</span>
|
9
|
-
<svg class="close-icon" width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
10
|
-
<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"/>
|
11
|
-
</svg>
|
12
|
-
</button>
|
13
|
-
</div>
|
14
|
-
</div>
|
15
|
-
{% endif %}
|
16
|
-
<div class="form-wrapper">
|
17
|
-
<div class="form-container">
|
18
|
-
<form action="" method="post" class="form-control">
|
19
|
-
{% csrf_token %}
|
20
|
-
<h1>sing up</h1>
|
21
|
-
|
22
|
-
<label for="username">Usuario:</label>
|
23
|
-
{{ form.username }}
|
24
|
-
|
25
|
-
<label for="password1">Contraseña:</label>
|
26
|
-
{{ form.password1 }}
|
27
|
-
|
28
|
-
<label for="password2">Confirmar Contraseña:</label>
|
29
|
-
{{ form.password2 }}
|
30
|
-
|
31
|
-
<button type="submit">sing Up</button>
|
32
|
-
</form>
|
33
|
-
</div>
|
34
|
-
</div>
|
35
|
-
{% endblock %}
|
36
|
-
{% block script %}
|
37
|
-
<script src="{% static 'js/alertErrors.js'%}"></script>
|
38
|
-
{% endblock %}
|
@@ -1,21 +0,0 @@
|
|
1
|
-
LICENSE
|
2
|
-
MANIFEST.in
|
3
|
-
README.md
|
4
|
-
setup.py
|
5
|
-
componentsDjangoType/__init__.py
|
6
|
-
componentsDjangoType.egg-info/PKG-INFO
|
7
|
-
componentsDjangoType.egg-info/SOURCES.txt
|
8
|
-
componentsDjangoType.egg-info/dependency_links.txt
|
9
|
-
componentsDjangoType.egg-info/requires.txt
|
10
|
-
componentsDjangoType.egg-info/top_level.txt
|
11
|
-
componentsDjangoType/management/__init__.py
|
12
|
-
componentsDjangoType/management/commands/__init__.py
|
13
|
-
componentsDjangoType/management/commands/createApp.py
|
14
|
-
componentsDjangoType/management/commands/createcomponent.py
|
15
|
-
componentsDjangoType/management/commands/utils/css/authentication.css
|
16
|
-
componentsDjangoType/management/commands/utils/js/alertErrors.js
|
17
|
-
componentsDjangoType/management/commands/utils/layouts/index.html
|
18
|
-
componentsDjangoType/management/commands/utils/pages/home.html
|
19
|
-
componentsDjangoType/management/commands/utils/pages/logged.html
|
20
|
-
componentsDjangoType/management/commands/utils/pages/login.html
|
21
|
-
componentsDjangoType/management/commands/utils/pages/singup.html
|
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-1.0.4 → componentsdjangotype-1.0.5}/componentsDjangoType.egg-info/requires.txt
RENAMED
File without changes
|
File without changes
|
File without changes
|