diff --git a/drfautoapi/drfautoapi.py b/drfautoapi/drfautoapi.py index b146daa83..9f3a3c502 100644 --- a/drfautoapi/drfautoapi.py +++ b/drfautoapi/drfautoapi.py @@ -211,9 +211,11 @@ class ApiViewSetConstrutor(): def router(cls, router_class=DefaultRouter): router = router_class() for app, built_sets in cls._built_sets.items(): + app_label = getattr(app, "label", app.name.split(".")[-1]) for model, viewset in built_sets.items(): router.register( - f'{app.label}/{model._meta.model_name}', viewset) + f'{app.label}/{model._meta.model_name}', viewset, + basename=f"{app_label}-{model._meta.model_name}") return router @classmethod diff --git a/requirements/requirements.txt b/requirements/requirements.txt index 3c8492dca..eff013303 100644 --- a/requirements/requirements.txt +++ b/requirements/requirements.txt @@ -1,56 +1,57 @@ # Core -Django==3.2.25 -gunicorn==23.0.0 - -# Search / indexing -django-haystack==3.2.1 -pysolr==3.6.0 - -# DRF & filtering -djangorestframework==3.12.4 -django-filter==2.4.0 -drf-spectacular==0.18.2 - -# DB & config -dj-database-url==0.5.0 -psycopg2-binary==2.9.9 -python-decouple==3.1 - -# Django utilities -django-crispy-forms==1.14.0 -django-braces==1.15.0 -django-extra-views==0.14.0 +Django==4.2.23 + +# Search / API / Forms +django-haystack==3.3.0 +django-filter==24.3 +djangorestframework==3.15.2 +django-crispy-forms==2.4 +crispy-bootstrap4==2024.1 + +# DB / utils +dj-database-url==2.2.0 +django-braces==1.17.0 +django-extra-views==0.16.0 django-model-utils==4.3.1 django-extensions==3.2.3 -django-waffle==3.0.0 -django-webpack-loader==1.6.0 django-ratelimit==3.0.1 -whitenoise==5.1.0 -django-prometheus==2.2.0 +easy-thumbnails==2.9.0 -# Images / files / PDFs -easy-thumbnails==2.8.5 -django-image-cropping==1.7 +# Images / files / PDF +django-image-cropping==1.7.0 Pillow==10.3.0 -rlPyCairo==0.3.0 -reportlab==4.2.0 -WeasyPrint==66 -trml2pdf==0.6 +weasyprint==66.0 PyPDF4==1.27.0 -python-magic==0.4.15 -# Other libs +# Frontend integration +django-webpack-loader==1.6.0 # (works; keep unless you’re moving to webpack5 forks) + +# Feature flags / misc +django-waffle==4.1.0 +whitenoise==6.9.0 + +# Monitoring +django-prometheus==2.4.1 + +# Other deps from your list (unchanged unless you want to bump) +python-decouple==3.1 +psycopg2-binary==2.9.9 pyyaml==6.0.1 -pytz==2024.1 -Unidecode==1.1.1 +# pytz is no longer required by Django; keep only if YOU use it directly: +# pytz==2024.1 +python-magic==0.4.15 unipath==1.1 -kazoo==2.8.0 +gunicorn==22.0.0 +more-itertools==8.2.0 +pysolr==3.6.0 +Unidecode==1.1.1 asn1crypto==1.5.1 XlsxWriter==3.2.0 -more-itertools==8.2.0 -# OAI (fork/commit you already use) +# Custom / VCS deps you already use git+https://github.com/infrae/pyoai@5ff2f15e869869e70d8139e4c37b7832854d7049 - -# Project-specific forks +git+https://github.com/interlegis/trml2pdf git+https://github.com/interlegis/django-admin-bootstrapped + +# REMOVE this old backport package completely (Django ships postgres contrib): +# django-contrib-postgres==0.0.1 diff --git a/sapl/settings.py b/sapl/settings.py index 4da82d0c4..a2dca55e7 100644 --- a/sapl/settings.py +++ b/sapl/settings.py @@ -84,6 +84,7 @@ INSTALLED_APPS = ( 'django_extensions', 'crispy_forms', + 'crispy_bootstrap4', 'waffle', @@ -330,7 +331,6 @@ if not TIME_ZONE: 'TIMEZONE env variable undefined in .env settings file! Leaving...') USE_I18N = True -USE_L10N = True USE_TZ = True # DATE_FORMAT = 'N j, Y' @@ -378,7 +378,7 @@ FILE_UPLOAD_PERMISSIONS = 0o644 DAB_FIELD_RENDERER = \ 'django_admin_bootstrapped.renderers.BootstrapFieldRenderer' CRISPY_TEMPLATE_PACK = 'bootstrap4' -CRISPY_ALLOWED_TEMPLATE_PACKS = 'bootstrap4' +CRISPY_ALLOWED_TEMPLATE_PACKS = ("bootstrap", "bootstrap4") CRISPY_FAIL_SILENTLY = not DEBUG # suprime texto de ajuda default do django-filter diff --git a/sapl/static/sapl/css/header-relatorio.css b/sapl/static/sapl/css/header-relatorio.css index 65f6f629d..fb479007e 100644 --- a/sapl/static/sapl/css/header-relatorio.css +++ b/sapl/static/sapl/css/header-relatorio.css @@ -1,62 +1,49 @@ +/* Header CSS for reports (WeasyPrint-friendly) */ html body p { - border-top: 1px solid black; - text-align: center; - font-size: 11pt; - padding: 5px; - margin-top: -15px; -} -html body section { - box-sizing: border-box; + border-top: 1px solid black; + text-align: center; + font-size: 11pt; + padding: 5px; + margin-top: -15px; } + +html body section { box-sizing: border-box; } + html body section dl { - display: flex; - flex-wrap: wrap; - rows: 2; - columns: 2; -} -html body section dt{ - width: 50px; + /* Keep flex; 'rows' is invalid, drop it. */ + display: flex; + flex-wrap: wrap; + /* If you actually want two columns of items, consider setting widths on + dt/dd or switching to column-count on a different container (see notes). */ } + +html body section dt { width: 50px; } + html body section dd { - max-width:550px; - text-align: center; + max-width: 550px; + text-align: center; } -html body section dd ul li { - list-style-type: none; - margin-left: 90px; - margin-bottom: -15px; -} -h2 { - font-size: 14pt; -} -h3 { - font-size: 10pt; - color: #6e6e6e; -} -ul { - padding: 0; - list-style: none; - margin-top:10px; +html body section dd ul li { + list-style-type: none; + margin-left: 90px; + margin-bottom: -15px; } -html body section dt img { - max-width:80px; - margin-left: 20px; - margin-left: 50px; +h2 { font-size: 14pt; } -} h3 { - font-size: 10pt; - color: #6e6e6e; + font-size: 10pt; + color: #6e6e6e; } + ul { - padding: 0; - list-style: none; - margin-top:10px; + padding: 0; + list-style: none; + margin-top: 10px; } html body section dt img { - max-width:80px; - margin-left: 20px; -} \ No newline at end of file + max-width: 80px; + margin-left: 20px; +} diff --git a/sapl/static/sapl/css/relatorio.css b/sapl/static/sapl/css/relatorio.css index 0dcbd8061..24f73785e 100644 --- a/sapl/static/sapl/css/relatorio.css +++ b/sapl/static/sapl/css/relatorio.css @@ -1,100 +1,97 @@ -@page{ - margin-top: 5.2cm; - size: A4 portrait; +/* Page box */ +@page { + /* portrait is default; keep it simple */ + size: A4; + margin-top: 5.2cm; } -h2.gray-title{ - color: gray; - font-size: 14pt; - break-after: avoid-page; - page-break-after: avoid; +/* Headings */ +h2.gray-title { + color: gray; + font-size: 14pt; + break-after: avoid; /* avoid-page -> avoid */ + page-break-after: avoid; } h3 { - font-size: 10pt; - break-after: avoid-page; - page-break-after: avoid; + font-size: 10pt; + break-after: avoid; + page-break-after: avoid; } p, a { - font-size: 10pt; - text-align: justify; - text-justify: inter-word; + font-size: 10pt; + text-align: justify; } +/* Fieldset */ fieldset { - border: 0; + border: 0; + page-break-after: avoid; + margin: 5px; + padding: 0; } -html body section { - box-sizing: border-box; -} +/* Layout */ +html body section { box-sizing: border-box; } html body section dl { - display: flex; - flex-wrap: wrap; - columns: 5; + display: flex; + flex-wrap: wrap; + column-count: 5; } -html body section dt{ - width: 50px; - text-align: left; +html body section dt { + width: 50px; + text-align: left; } -html body section dd { - text-align: center; -} +html body section dd { text-align: center; } html body section dd ul li { - list-style-type: none; - margin-left: 50px; + list-style-type: none; + margin-left: 50px; } -fieldset { - page-break-after: avoid; - margin:5px; - padding:0px; -} +/* Tables */ +table { table-layout: fixed; max-width: 520px; } - -table { - table-layout: fixed; - max-width: 520px; -} table.grayTable { - border: 1px solid #6e6e6e; - width: 100%; - text-align: left; - border-collapse: collapse; + border: 1px solid #6e6e6e; + width: 100%; + text-align: left; + border-collapse: collapse; } -table.grayTable td, table.grayTable th { - border: 1px solid #000000; - padding: 5px; - overflow-wrap: break-word; - word-wrap: break-word; - text-align: justify; - vertical-align: top; + +table.grayTable td, +table.grayTable th { + border: 1px solid #000; + padding: 5px; + overflow-wrap: break-word; + word-wrap: break-word; + text-align: justify; + vertical-align: top; } + table.grayTable tbody td { - font-size: 10px; - max-width: 80px; - overflow-wrap: break-word; - word-wrap: break-word; - text-align: justify; -} -table.grayTable tr:nth-child(even) { - background: #ffffff; + font-size: 10px; + max-width: 80px; + overflow-wrap: break-word; + word-wrap: break-word; + text-align: justify; } + +table.grayTable tr:nth-child(even) { background: #fff; } + table.grayTable thead { - background: #BBBBBB; - border-bottom: 2px solid #000000; + background: #BBB; + border-bottom: 2px solid #000; } -table.grayTable thead th { - font-size:10px; - color: rgb(0, 0, 0); - border-left: 1px solid #000000; +table.grayTable thead th { + font-size: 10px; + color: #000; + border-left: 1px solid #000; } -table.grayTable thead th:first-child { - border-left: none; -} \ No newline at end of file + +table.grayTable thead th:first-child { border-left: none; }