This commit is contained in:
root
2025-12-21 15:14:34 -06:00
commit c04ee70afc
40 changed files with 3048 additions and 0 deletions

0
ciec/__init__.py Executable file
View File

16
ciec/asgi.py Executable file
View File

@@ -0,0 +1,16 @@
"""
ASGI config for ciec project.
It exposes the ASGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/4.2/howto/deployment/asgi/
"""
import os
from django.core.asgi import get_asgi_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'ciec.settings')
application = get_asgi_application()

43
ciec/procesos.py Executable file
View File

@@ -0,0 +1,43 @@
from django.db import transaction
from django.db import connection
from datetime import datetime, timedelta
#from explorer.models import Query
def dictfetchall(cursor):
desc = cursor.description
if desc:
return [
dict(zip([col[0] for col in desc],row))
for row in cursor.fetchall()
]
else:
return None
def execsql(consulta):
cursor = connection.cursor()
#print(consulta)
cursor.execute(consulta)
result_list = dictfetchall(cursor)
cursor.close()
return result_list
def styles_workbook(workbook):
#workbook = writer.book
#styles = []
style = {}
style['titulos'] = workbook.add_format({'bold': True, 'align': 'center', 'valign': 'vcenter'})
style['celdas'] = workbook.add_format({'align': 'center', 'valign': 'vcenter'})
style['bordes'] = workbook.add_format({'bottom': 1})
style['descripcion'] = workbook.add_format({'align': 'left', 'valign': 'vjustify'})
style['numeros'] = workbook.add_format({'num_format': '#,##0.00', 'valign': 'vcenter'})
style['fechas'] = workbook.add_format({'align': 'center', 'valign': 'vcenter', 'num_format' : 'dd/mmm/yyyy' })
style['cabecera'] = workbook.add_format({'bold': True, 'text_wrap': True, 'valign': 'top', 'align' : 'center', 'fg_color': '#D7E4BC', 'border': 1})
style['condicion1'] = workbook.add_format({'bold': True, 'bg_color': '#FFC7CE', 'font_color': '#9C0006'})
style['condicion2'] = workbook.add_format({'bold': True, 'bg_color': '#C6EFCE', 'font_color': '#006100'})
style['ocultar'] = workbook.add_format({'font_color': '#FFFFFF'})
#styles.append(style)
return style

152
ciec/settings.py Executable file
View File

@@ -0,0 +1,152 @@
"""
Django settings for ciec project.
Generated by 'django-admin startproject' using Django 4.2.20.
For more information on this file, see
https://docs.djangoproject.com/en/4.2/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/4.2/ref/settings/
"""
from pathlib import Path
import os
# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/4.2/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'django-insecure-t&8&t7$9(#9jni(4yva_2=x&#gz#@s7nx&lwv132he$6_p4d7%'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
ALLOWED_HOSTS = ['*']
# Application definition
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'catalogos',
'condominio_aragon_37',
'condominio_balcones',
'condominio_coyoacan',
'condominio_sadicarnot81_Nvo',
]
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'whitenoise.middleware.WhiteNoiseMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'django.middleware.locale.LocaleMiddleware',
]
ROOT_URLCONF = 'ciec.urls'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [os.path.join(BASE_DIR, 'templates/')],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.template.context_processors.csrf',
'django.contrib.messages.context_processors.messages',
],
},
},
]
WSGI_APPLICATION = 'ciec.wsgi.application'
# Database
# https://docs.djangoproject.com/en/4.2/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'postgres',
'USER': 'postgres',
'PASSWORD': 'mejia1963',
#'HOST': '172.17.0.2',
'HOST': '10.6.0.2',
'PORT': '5432',
}
}
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
# Password validation
# https://docs.djangoproject.com/en/4.2/ref/settings/#auth-password-validators
AUTH_PASSWORD_VALIDATORS = [
{
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
},
]
# Internationalization
# https://docs.djangoproject.com/en/4.2/topics/i18n/
LANGUAGE_CODE = 'es-MX'
TIME_ZONE = 'America/Mexico_City'
USE_I18N = True
USE_L10N = True
USE_TZ = True
NUMBER_GROUPING = (3,2,0)
USE_DECIMAL_SEPARATOR = True
DECIMAL_SEPARATOR = '.'
USE_THOUSAND_SEPARATOR = True
THOUSAND_SEPARATOR = ','
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/4.2/howto/static-files/
STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')
STATICFILES_DIRS = (
os.path.join(BASE_DIR, 'static'),
)
STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'

22
ciec/urls.py Executable file
View File

@@ -0,0 +1,22 @@
from django.contrib import admin
#from django.conf.urls import url
from django.urls import path, include, re_path
from django.conf import settings
from catalogos.views import home
#from django.utils.functional import curry
from django.views.defaults import server_error, page_not_found
from django.conf.urls.static import static
from functools import partial as curry
admin.site.site_header = "CIEC Cuotas, Ingresos y Egresos Condominales"
admin.site.site_title = "CIEC"
admin.site.index_title = "Administración"
handler500 = curry(server_error, template_name='admin/500.html')
handler404 = curry(page_not_found, template_name='admin/404.html')
urlpatterns = [
re_path(r'^$', home, name='home'),
re_path(r'^5up3rc4l1fr4ct1c03sp1r4l1d0s0/', admin.site.urls, name = 'admin'),
] + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)

16
ciec/wsgi.py Executable file
View File

@@ -0,0 +1,16 @@
"""
WSGI config for ciec project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/4.2/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'ciec.settings')
application = get_wsgi_application()