componentsDjangoType 2.0.1__tar.gz → 2.0.3__tar.gz

Sign up to get free protection for your applications and to get access to all the features.
Files changed (16) hide show
  1. {componentsdjangotype-2.0.1/componentsDjangoType.egg-info → componentsdjangotype-2.0.3}/PKG-INFO +1 -1
  2. {componentsdjangotype-2.0.1 → componentsdjangotype-2.0.3}/componentsDjangoType/management/commands/createApp.py +25 -11
  3. {componentsdjangotype-2.0.1 → componentsdjangotype-2.0.3/componentsDjangoType.egg-info}/PKG-INFO +1 -1
  4. {componentsdjangotype-2.0.1 → componentsdjangotype-2.0.3}/setup.py +1 -1
  5. {componentsdjangotype-2.0.1 → componentsdjangotype-2.0.3}/LICENSE +0 -0
  6. {componentsdjangotype-2.0.1 → componentsdjangotype-2.0.3}/MANIFEST.in +0 -0
  7. {componentsdjangotype-2.0.1 → componentsdjangotype-2.0.3}/README.md +0 -0
  8. {componentsdjangotype-2.0.1 → componentsdjangotype-2.0.3}/componentsDjangoType/__init__.py +0 -0
  9. {componentsdjangotype-2.0.1 → componentsdjangotype-2.0.3}/componentsDjangoType/management/__init__.py +0 -0
  10. {componentsdjangotype-2.0.1 → componentsdjangotype-2.0.3}/componentsDjangoType/management/commands/__init__.py +0 -0
  11. {componentsdjangotype-2.0.1 → componentsdjangotype-2.0.3}/componentsDjangoType/management/commands/createcomponent.py +0 -0
  12. {componentsdjangotype-2.0.1 → componentsdjangotype-2.0.3}/componentsDjangoType.egg-info/SOURCES.txt +0 -0
  13. {componentsdjangotype-2.0.1 → componentsdjangotype-2.0.3}/componentsDjangoType.egg-info/dependency_links.txt +0 -0
  14. {componentsdjangotype-2.0.1 → componentsdjangotype-2.0.3}/componentsDjangoType.egg-info/requires.txt +0 -0
  15. {componentsdjangotype-2.0.1 → componentsdjangotype-2.0.3}/componentsDjangoType.egg-info/top_level.txt +0 -0
  16. {componentsdjangotype-2.0.1 → componentsdjangotype-2.0.3}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: componentsDjangoType
3
- Version: 2.0.1
3
+ Version: 2.0.3
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
@@ -28,9 +28,28 @@ class Command(BaseCommand):
28
28
  if not os.path.exists(app_name):
29
29
  self.stdout.write(f"Creando la aplicación '{app_name}'...")
30
30
  call_command('startapp', app_name)
31
+ if os.path.exists(app_name):
32
+ self.stdout.write(f"La aplicación '{
33
+ app_name}' fue creada exitosamente.")
34
+ else:
35
+ self.stdout.write(
36
+ f"Error: No se pudo crear la aplicación '{app_name}'.")
31
37
  else:
32
38
  self.stdout.write(f"La aplicación '{app_name}' ya existe.")
33
39
 
40
+ # Agregar automáticamente 'Home' a INSTALLED_APPS
41
+ settings_path = os.path.join(project_name, 'settings.py')
42
+
43
+ with open(settings_path, 'r') as file:
44
+ settings_content = file.read()
45
+
46
+ if f"'{app_name}'" not in settings_content:
47
+ with open(settings_path, 'a') as file:
48
+ file.write(f"\nINSTALLED_APPS.append('{app_name}')\n")
49
+ self.stdout.write(f"'{app_name}' fue agregado a INSTALLED_APPS.")
50
+ else:
51
+ self.stdout.write(f"'{app_name}' ya está en INSTALLED_APPS.")
52
+
34
53
  # Paso 3: Crear el archivo urls.py en la aplicación "Home" si no existe
35
54
  urls_path = os.path.join(app_name, 'urls.py')
36
55
  if not os.path.exists(urls_path):
@@ -90,7 +109,7 @@ class Command(BaseCommand):
90
109
  " @staticmethod\n"
91
110
  " def get_signup(request):\n"
92
111
  " if request.method == 'GET':\n"
93
- " return render(request, 'singup.html', {\n"
112
+ " return render(request, 'signup.html', {\n"
94
113
  " 'form': UserCreationForm()\n"
95
114
  " })\n"
96
115
  " elif request.method == 'POST':\n"
@@ -103,11 +122,11 @@ class Command(BaseCommand):
103
122
  " login(request, user)\n"
104
123
  " return redirect('logged')\n"
105
124
  " except IntegrityError:\n"
106
- " return render(request, 'singup.html', {\n"
125
+ " return render(request, 'signup.html', {\n"
107
126
  " 'form': UserCreationForm(),\n"
108
127
  " 'error': 'User already exists'\n"
109
128
  " })\n"
110
- " return render(request, 'singup.html', {\n"
129
+ " return render(request, 'signup.html', {\n"
111
130
  " 'form': UserCreationForm(),\n"
112
131
  " 'error': 'Passwords do not match'\n"
113
132
  " })\n\n"
@@ -293,9 +312,7 @@ urlpatterns = [
293
312
  </div>
294
313
  </div>
295
314
  {% endblock %}
296
- {% block script %}
297
- <script src="{% static 'js/alertErrors.js'%}"></script>
298
- {% endblock %}""",
315
+ """,
299
316
  'login.html': """{% extends "layouts/index.html" %}
300
317
  {% block layout %}
301
318
  {% if error %}
@@ -328,9 +345,7 @@ urlpatterns = [
328
345
  </div>
329
346
  </div>
330
347
  {% endblock %}
331
- {% block script %}
332
- <script src="{% static 'js/alertErrors.js'%}"></script>
333
- {% endblock %}""",
348
+ """,
334
349
  'logged.html': """{% extends "layouts/index.html" %}
335
350
  {% block layout %}
336
351
  <div class="layout-container">
@@ -606,8 +621,7 @@ button[type="submit"]:hover {
606
621
  {% endblock %}
607
622
  </div>
608
623
 
609
- {% block script %}
610
- {% endblock %}
624
+ <script src="{% static 'js/alertErrors.js'%}"></script>
611
625
  </body>
612
626
  </html>
613
627
  """)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: componentsDjangoType
3
- Version: 2.0.1
3
+ Version: 2.0.3
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
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
4
  name='componentsDjangoType',
5
- version='2.0.1',
5
+ version='2.0.3',
6
6
  packages=find_packages(),
7
7
  include_package_data=True,
8
8
  license='MIT',