componentsDjangoType 0.0.1__tar.gz
Sign up to get free protection for your applications and to get access to all the features.
- componentsDjangoType-0.0.1/LICENSE +21 -0
- componentsDjangoType-0.0.1/MANIFEST.in +4 -0
- componentsDjangoType-0.0.1/PKG-INFO +23 -0
- componentsDjangoType-0.0.1/README.md +1 -0
- componentsDjangoType-0.0.1/componentsDjangoType.egg-info/PKG-INFO +23 -0
- componentsDjangoType-0.0.1/componentsDjangoType.egg-info/SOURCES.txt +13 -0
- componentsDjangoType-0.0.1/componentsDjangoType.egg-info/dependency_links.txt +1 -0
- componentsDjangoType-0.0.1/componentsDjangoType.egg-info/requires.txt +1 -0
- componentsDjangoType-0.0.1/componentsDjangoType.egg-info/top_level.txt +1 -0
- componentsDjangoType-0.0.1/settings/__init__.py +0 -0
- componentsDjangoType-0.0.1/settings/management/__init__.py +0 -0
- componentsDjangoType-0.0.1/settings/management/commands/__init__.py +0 -0
- componentsDjangoType-0.0.1/settings/management/commands/createcomponent.py +57 -0
- componentsDjangoType-0.0.1/setup.cfg +4 -0
- componentsDjangoType-0.0.1/setup.py +29 -0
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2024 Alejandro Rivas
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
@@ -0,0 +1,23 @@
|
|
1
|
+
Metadata-Version: 2.1
|
2
|
+
Name: componentsDjangoType
|
3
|
+
Version: 0.0.1
|
4
|
+
Summary: A Django app for creating HTML components
|
5
|
+
Home-page: https://github.com/jose-CR/componentsDjangoType
|
6
|
+
Author: Alejandro
|
7
|
+
Author-email: your-email@example.com
|
8
|
+
License: MIT
|
9
|
+
Platform: UNKNOWN
|
10
|
+
Classifier: Environment :: Web Environment
|
11
|
+
Classifier: Framework :: Django
|
12
|
+
Classifier: Intended Audience :: Developers
|
13
|
+
Classifier: License :: OSI Approved :: MIT License
|
14
|
+
Classifier: Operating System :: OS Independent
|
15
|
+
Classifier: Programming Language :: Python
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
17
|
+
Classifier: Programming Language :: Python :: 3.7
|
18
|
+
Classifier: Framework :: Django :: 3.2
|
19
|
+
Description-Content-Type: text/markdown
|
20
|
+
License-File: LICENSE
|
21
|
+
|
22
|
+
# componentsDjangotype
|
23
|
+
|
@@ -0,0 +1 @@
|
|
1
|
+
# componentsDjangotype
|
@@ -0,0 +1,23 @@
|
|
1
|
+
Metadata-Version: 2.1
|
2
|
+
Name: componentsDjangoType
|
3
|
+
Version: 0.0.1
|
4
|
+
Summary: A Django app for creating HTML components
|
5
|
+
Home-page: https://github.com/jose-CR/componentsDjangoType
|
6
|
+
Author: Alejandro
|
7
|
+
Author-email: your-email@example.com
|
8
|
+
License: MIT
|
9
|
+
Platform: UNKNOWN
|
10
|
+
Classifier: Environment :: Web Environment
|
11
|
+
Classifier: Framework :: Django
|
12
|
+
Classifier: Intended Audience :: Developers
|
13
|
+
Classifier: License :: OSI Approved :: MIT License
|
14
|
+
Classifier: Operating System :: OS Independent
|
15
|
+
Classifier: Programming Language :: Python
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
17
|
+
Classifier: Programming Language :: Python :: 3.7
|
18
|
+
Classifier: Framework :: Django :: 3.2
|
19
|
+
Description-Content-Type: text/markdown
|
20
|
+
License-File: LICENSE
|
21
|
+
|
22
|
+
# componentsDjangotype
|
23
|
+
|
@@ -0,0 +1,13 @@
|
|
1
|
+
LICENSE
|
2
|
+
MANIFEST.in
|
3
|
+
README.md
|
4
|
+
setup.py
|
5
|
+
componentsDjangoType.egg-info/PKG-INFO
|
6
|
+
componentsDjangoType.egg-info/SOURCES.txt
|
7
|
+
componentsDjangoType.egg-info/dependency_links.txt
|
8
|
+
componentsDjangoType.egg-info/requires.txt
|
9
|
+
componentsDjangoType.egg-info/top_level.txt
|
10
|
+
settings/__init__.py
|
11
|
+
settings/management/__init__.py
|
12
|
+
settings/management/commands/__init__.py
|
13
|
+
settings/management/commands/createcomponent.py
|
@@ -0,0 +1 @@
|
|
1
|
+
|
@@ -0,0 +1 @@
|
|
1
|
+
Django>=3.2
|
@@ -0,0 +1 @@
|
|
1
|
+
settings
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1,57 @@
|
|
1
|
+
from django.core.management.base import BaseCommand, CommandError
|
2
|
+
from django.apps import apps
|
3
|
+
import os
|
4
|
+
|
5
|
+
class Command(BaseCommand):
|
6
|
+
help = 'Crear un archivo HTML dentro de la carpeta templates o static de una app'
|
7
|
+
|
8
|
+
def add_arguments(self, parser):
|
9
|
+
parser.add_argument('app_name', type=str, help='Nombre de la app')
|
10
|
+
parser.add_argument('file_path', type=str, help='Ruta del componente HTML')
|
11
|
+
parser.add_argument(
|
12
|
+
'--type',
|
13
|
+
type=str,
|
14
|
+
choices=['template', 'static'],
|
15
|
+
default='template',
|
16
|
+
help='Tipo de archivo a crear: "template" para archivos en la carpeta templates, "static" para archivos en la carpeta static'
|
17
|
+
)
|
18
|
+
|
19
|
+
def handle(self, *args, **kwargs):
|
20
|
+
app_name = kwargs['app_name']
|
21
|
+
file_path = kwargs['file_path']
|
22
|
+
file_type = kwargs['type']
|
23
|
+
|
24
|
+
try:
|
25
|
+
app_config = apps.get_app_config(app_name)
|
26
|
+
except LookupError:
|
27
|
+
raise CommandError(f'App "{app_name}" no encontrada.')
|
28
|
+
|
29
|
+
base_dir = os.path.join(app_config.path, 'templates' if file_type == 'template' else 'static')
|
30
|
+
|
31
|
+
if not os.path.exists(base_dir):
|
32
|
+
os.makedirs(base_dir)
|
33
|
+
|
34
|
+
file_full_path = os.path.join(base_dir, file_path)
|
35
|
+
file_full_path = os.path.normpath(file_full_path)
|
36
|
+
|
37
|
+
file_folder = os.path.dirname(file_full_path)
|
38
|
+
if not os.path.exists(file_folder):
|
39
|
+
os.makedirs(file_folder)
|
40
|
+
|
41
|
+
if os.path.exists(file_full_path):
|
42
|
+
self.stdout.write(self.style.WARNING(f'El archivo {file_path} ya existe en {app_name}/{file_type}/.'))
|
43
|
+
else:
|
44
|
+
file_extension = os.path.splitext(file_path)[1]
|
45
|
+
if file_extension == '.html':
|
46
|
+
content = '<div>Este es el contenido del componente.</div>'
|
47
|
+
elif file_extension == '.js':
|
48
|
+
content = 'console.log("Este es el contenido del componente.");'
|
49
|
+
elif file_extension == '.css':
|
50
|
+
content = '/* Este es el contenido del componente */'
|
51
|
+
else:
|
52
|
+
content = ''
|
53
|
+
|
54
|
+
with open(file_full_path, 'w') as f:
|
55
|
+
f.write(content)
|
56
|
+
|
57
|
+
self.stdout.write(self.style.SUCCESS(f'Se creó correctamente {file_path} en {app_name}/{file_type}/.'))
|
@@ -0,0 +1,29 @@
|
|
1
|
+
from setuptools import setup, find_packages
|
2
|
+
|
3
|
+
setup(
|
4
|
+
name='componentsDjangoType',
|
5
|
+
version='0.0.1',
|
6
|
+
packages=find_packages(),
|
7
|
+
include_package_data=True,
|
8
|
+
license='MIT',
|
9
|
+
description='A Django app for creating HTML components',
|
10
|
+
long_description=open('README.md').read(),
|
11
|
+
long_description_content_type='text/markdown',
|
12
|
+
url='https://github.com/jose-CR/componentsDjangoType',
|
13
|
+
author='Alejandro',
|
14
|
+
author_email='your-email@example.com',
|
15
|
+
classifiers=[
|
16
|
+
'Environment :: Web Environment',
|
17
|
+
'Framework :: Django',
|
18
|
+
'Intended Audience :: Developers',
|
19
|
+
'License :: OSI Approved :: MIT License',
|
20
|
+
'Operating System :: OS Independent',
|
21
|
+
'Programming Language :: Python',
|
22
|
+
'Programming Language :: Python :: 3',
|
23
|
+
'Programming Language :: Python :: 3.7',
|
24
|
+
'Framework :: Django :: 3.2',
|
25
|
+
],
|
26
|
+
install_requires=[
|
27
|
+
'Django>=3.2',
|
28
|
+
],
|
29
|
+
)
|