componentsDjangoType 1.0.8__tar.gz → 1.0.10__tar.gz
Sign up to get free protection for your applications and to get access to all the features.
- {componentsdjangotype-1.0.8/componentsDjangoType.egg-info → componentsdjangotype-1.0.10}/PKG-INFO +1 -1
- {componentsdjangotype-1.0.8 → componentsdjangotype-1.0.10}/componentsDjangoType/management/commands/createApp.py +149 -79
- {componentsdjangotype-1.0.8 → componentsdjangotype-1.0.10/componentsDjangoType.egg-info}/PKG-INFO +1 -1
- {componentsdjangotype-1.0.8 → componentsdjangotype-1.0.10}/setup.py +1 -1
- {componentsdjangotype-1.0.8 → componentsdjangotype-1.0.10}/LICENSE +0 -0
- {componentsdjangotype-1.0.8 → componentsdjangotype-1.0.10}/MANIFEST.in +0 -0
- {componentsdjangotype-1.0.8 → componentsdjangotype-1.0.10}/README.md +0 -0
- {componentsdjangotype-1.0.8 → componentsdjangotype-1.0.10}/componentsDjangoType/__init__.py +0 -0
- {componentsdjangotype-1.0.8 → componentsdjangotype-1.0.10}/componentsDjangoType/management/__init__.py +0 -0
- {componentsdjangotype-1.0.8 → componentsdjangotype-1.0.10}/componentsDjangoType/management/commands/__init__.py +0 -0
- {componentsdjangotype-1.0.8 → componentsdjangotype-1.0.10}/componentsDjangoType/management/commands/createcomponent.py +0 -0
- {componentsdjangotype-1.0.8 → componentsdjangotype-1.0.10}/componentsDjangoType.egg-info/SOURCES.txt +0 -0
- {componentsdjangotype-1.0.8 → componentsdjangotype-1.0.10}/componentsDjangoType.egg-info/dependency_links.txt +0 -0
- {componentsdjangotype-1.0.8 → componentsdjangotype-1.0.10}/componentsDjangoType.egg-info/requires.txt +0 -0
- {componentsdjangotype-1.0.8 → componentsdjangotype-1.0.10}/componentsDjangoType.egg-info/top_level.txt +0 -0
- {componentsdjangotype-1.0.8 → componentsdjangotype-1.0.10}/setup.cfg +0 -0
@@ -161,7 +161,77 @@ class Command(BaseCommand):
|
|
161
161
|
self.stdout.write(
|
162
162
|
f"El archivo '{authentication_file_path}' ya existe.")
|
163
163
|
|
164
|
-
|
164
|
+
home_dir = "Home"
|
165
|
+
|
166
|
+
def modify_views_and_urls():
|
167
|
+
# Rutas de los archivos
|
168
|
+
views_path = os.path.join(home_dir, 'views.py')
|
169
|
+
urls_path = os.path.join(home_dir, 'urls.py')
|
170
|
+
|
171
|
+
# Contenido de views.py
|
172
|
+
views_content = """from django.shortcuts import render
|
173
|
+
from django.contrib.auth.decorators import login_required
|
174
|
+
from Home.services.authentication import Authentication
|
175
|
+
|
176
|
+
# Create your views here.
|
177
|
+
|
178
|
+
def home(request):
|
179
|
+
return render(request, 'home.html')
|
180
|
+
|
181
|
+
|
182
|
+
def signup(request):
|
183
|
+
return Authentication.get_signup(request)
|
184
|
+
|
185
|
+
|
186
|
+
def signout(request):
|
187
|
+
return Authentication.get_signout(request)
|
188
|
+
|
189
|
+
|
190
|
+
def signing(request):
|
191
|
+
return Authentication.get_signing(request)
|
192
|
+
|
193
|
+
|
194
|
+
@login_required
|
195
|
+
def logged(request):
|
196
|
+
return Authentication.get_logged(request)
|
197
|
+
|
198
|
+
|
199
|
+
def custom_dispatch(request, *args, **kwargs):
|
200
|
+
return Authentication.dispatch(request, *args, **kwargs)
|
201
|
+
"""
|
202
|
+
|
203
|
+
# Contenido de urls.py
|
204
|
+
urls_content = """from django.urls import path
|
205
|
+
from . import views
|
206
|
+
|
207
|
+
urlpatterns = [
|
208
|
+
path("", views.home, name='home'),
|
209
|
+
path("signup", views.signup, name='signup'),
|
210
|
+
path("login", views.signing, name='login'),
|
211
|
+
path("logout", views.signout, name='logout'),
|
212
|
+
path("logged", views.logged, name='logged'),
|
213
|
+
]
|
214
|
+
"""
|
215
|
+
|
216
|
+
# Escritura de views.py
|
217
|
+
try:
|
218
|
+
with open(views_path, 'w') as views_file:
|
219
|
+
views_file.write(views_content.strip())
|
220
|
+
print(f"Archivo modificado correctamente: {views_path}")
|
221
|
+
except Exception as e:
|
222
|
+
print(f"Error al modificar {views_path}: {e}")
|
223
|
+
|
224
|
+
# Escritura de urls.py
|
225
|
+
try:
|
226
|
+
with open(urls_path, 'w') as urls_file:
|
227
|
+
urls_file.write(urls_content.strip())
|
228
|
+
print(f"Archivo modificado correctamente: {urls_path}")
|
229
|
+
except Exception as e:
|
230
|
+
print(f"Error al modificar {urls_path}: {e}")
|
231
|
+
|
232
|
+
modify_views_and_urls()
|
233
|
+
|
234
|
+
# Paso 8: Crear la carpeta templates y estatic y los archivos HTML CSS y JS
|
165
235
|
templates_dir = os.path.join(app_name, 'templates')
|
166
236
|
static_dir = os.path.join(app_name, 'static')
|
167
237
|
|
@@ -187,87 +257,87 @@ class Command(BaseCommand):
|
|
187
257
|
|
188
258
|
template_files = {
|
189
259
|
'home.html': """{% extends "layouts/index.html" %}
|
190
|
-
|
191
|
-
|
260
|
+
{% block layout %}
|
261
|
+
{% endblock %}""",
|
192
262
|
'signup.html': """{% extends "layouts/index.html" %}
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
263
|
+
{% block layout %}
|
264
|
+
{% if error %}
|
265
|
+
<div class="alert" id="alert">
|
266
|
+
<div class="alert-content">
|
267
|
+
{{ error }}
|
268
|
+
<button class="close-btn" onclick="closeAlert()">
|
269
|
+
<span class="sr-only">Close</span>
|
270
|
+
<svg class="close-icon" width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
271
|
+
<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"/>
|
272
|
+
</svg>
|
273
|
+
</button>
|
274
|
+
</div>
|
275
|
+
</div>
|
276
|
+
{% endif %}\n
|
277
|
+
<div class="form-wrapper">
|
278
|
+
<div class="form-container">
|
279
|
+
<form action="" method="post" class="form-control">
|
280
|
+
{% csrf_token %}
|
281
|
+
<h1>sing up</h1>
|
282
|
+
|
283
|
+
<label for="username">Usuario:</label>
|
284
|
+
{{ form.username }}
|
285
|
+
|
286
|
+
<label for="password1">Contraseña:</label>
|
287
|
+
{{ form.password1 }}
|
288
|
+
|
289
|
+
<label for="password2">Confirmar Contraseña:</label>
|
290
|
+
{{ form.password2 }}
|
291
|
+
|
292
|
+
<button type="submit">sing Up</button>
|
293
|
+
</form>
|
294
|
+
</div>
|
295
|
+
</div>
|
296
|
+
{% endblock %}
|
297
|
+
{% block script %}
|
298
|
+
<script src="{% static 'js/alertErrors.js'%}"></script>
|
299
|
+
{% endblock %}""",
|
230
300
|
'login.html': """{% extends "layouts/index.html" %}
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
301
|
+
{% block layout %}
|
302
|
+
{% if error %}
|
303
|
+
<div class="alert" id="alert">
|
304
|
+
<div class="alert-content">
|
305
|
+
{{ error }}
|
306
|
+
<button class="close-btn" onclick="closeAlert()">
|
307
|
+
<span class="sr-only">Close</span>
|
308
|
+
<svg class="close-icon" width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
309
|
+
<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"/>
|
310
|
+
</svg>
|
311
|
+
</button>
|
312
|
+
</div>
|
313
|
+
</div>
|
314
|
+
{% endif %}
|
315
|
+
<div class="form-wrapper">\n
|
316
|
+
<div class="form-container">
|
317
|
+
<form action="" method="post" class="form-control">
|
318
|
+
{% csrf_token %}
|
319
|
+
<h1>Login</h1>
|
320
|
+
|
321
|
+
<label for="username">Usuario:</label>
|
322
|
+
{{ form.username }}
|
323
|
+
|
324
|
+
<label for="password">Contraseña:</label>
|
325
|
+
<input type="password" id="password" name="password" value="{{ form.password2 }}" required>
|
326
|
+
|
327
|
+
<button type="submit">Login</button>
|
328
|
+
</form>
|
329
|
+
</div>
|
330
|
+
</div>
|
331
|
+
{% endblock %}
|
332
|
+
{% block script %}
|
333
|
+
<script src="{% static 'js/alertErrors.js'%}"></script>
|
334
|
+
{% endblock %}""",
|
265
335
|
'logged.html': """{% extends "layouts/index.html" %}
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
336
|
+
{% block layout %}
|
337
|
+
<div class="layout-container">
|
338
|
+
<h1>¡Has iniciado sesión!</h1>
|
339
|
+
</div>
|
340
|
+
{% endblock %}"""
|
271
341
|
}
|
272
342
|
for template_file, content in template_files.items():
|
273
343
|
template_file_path = os.path.join(templates_dir, template_file)
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{componentsdjangotype-1.0.8 → componentsdjangotype-1.0.10}/componentsDjangoType.egg-info/SOURCES.txt
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|