Browse Source

Bump 4

upgrade-sapl
Edward Ribeiro 2 months ago
parent
commit
22354862fd
  1. 4
      drfautoapi/drfautoapi.py
  2. 83
      requirements/requirements.txt
  3. 4
      sapl/settings.py
  4. 79
      sapl/static/sapl/css/header-relatorio.css
  5. 131
      sapl/static/sapl/css/relatorio.css

4
drfautoapi/drfautoapi.py

@ -211,9 +211,11 @@ class ApiViewSetConstrutor():
def router(cls, router_class=DefaultRouter): def router(cls, router_class=DefaultRouter):
router = router_class() router = router_class()
for app, built_sets in cls._built_sets.items(): 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(): for model, viewset in built_sets.items():
router.register( 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 return router
@classmethod @classmethod

83
requirements/requirements.txt

@ -1,56 +1,57 @@
# Core # Core
Django==3.2.25 Django==4.2.23
gunicorn==23.0.0
# Search / API / Forms
# Search / indexing django-haystack==3.3.0
django-haystack==3.2.1 django-filter==24.3
pysolr==3.6.0 djangorestframework==3.15.2
django-crispy-forms==2.4
# DRF & filtering crispy-bootstrap4==2024.1
djangorestframework==3.12.4
django-filter==2.4.0 # DB / utils
drf-spectacular==0.18.2 dj-database-url==2.2.0
django-braces==1.17.0
# DB & config django-extra-views==0.16.0
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-model-utils==4.3.1 django-model-utils==4.3.1
django-extensions==3.2.3 django-extensions==3.2.3
django-waffle==3.0.0
django-webpack-loader==1.6.0
django-ratelimit==3.0.1 django-ratelimit==3.0.1
whitenoise==5.1.0 easy-thumbnails==2.9.0
django-prometheus==2.2.0
# Images / files / PDFs # Images / files / PDF
easy-thumbnails==2.8.5 django-image-cropping==1.7.0
django-image-cropping==1.7
Pillow==10.3.0 Pillow==10.3.0
rlPyCairo==0.3.0 weasyprint==66.0
reportlab==4.2.0
WeasyPrint==66
trml2pdf==0.6
PyPDF4==1.27.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 pyyaml==6.0.1
pytz==2024.1 # pytz is no longer required by Django; keep only if YOU use it directly:
Unidecode==1.1.1 # pytz==2024.1
python-magic==0.4.15
unipath==1.1 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 asn1crypto==1.5.1
XlsxWriter==3.2.0 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 git+https://github.com/infrae/pyoai@5ff2f15e869869e70d8139e4c37b7832854d7049
git+https://github.com/interlegis/trml2pdf
# Project-specific forks
git+https://github.com/interlegis/django-admin-bootstrapped git+https://github.com/interlegis/django-admin-bootstrapped
# REMOVE this old backport package completely (Django ships postgres contrib):
# django-contrib-postgres==0.0.1

4
sapl/settings.py

@ -84,6 +84,7 @@ INSTALLED_APPS = (
'django_extensions', 'django_extensions',
'crispy_forms', 'crispy_forms',
'crispy_bootstrap4',
'waffle', 'waffle',
@ -330,7 +331,6 @@ if not TIME_ZONE:
'TIMEZONE env variable undefined in .env settings file! Leaving...') 'TIMEZONE env variable undefined in .env settings file! Leaving...')
USE_I18N = True USE_I18N = True
USE_L10N = True
USE_TZ = True USE_TZ = True
# DATE_FORMAT = 'N j, Y' # DATE_FORMAT = 'N j, Y'
@ -378,7 +378,7 @@ FILE_UPLOAD_PERMISSIONS = 0o644
DAB_FIELD_RENDERER = \ DAB_FIELD_RENDERER = \
'django_admin_bootstrapped.renderers.BootstrapFieldRenderer' 'django_admin_bootstrapped.renderers.BootstrapFieldRenderer'
CRISPY_TEMPLATE_PACK = 'bootstrap4' CRISPY_TEMPLATE_PACK = 'bootstrap4'
CRISPY_ALLOWED_TEMPLATE_PACKS = 'bootstrap4' CRISPY_ALLOWED_TEMPLATE_PACKS = ("bootstrap", "bootstrap4")
CRISPY_FAIL_SILENTLY = not DEBUG CRISPY_FAIL_SILENTLY = not DEBUG
# suprime texto de ajuda default do django-filter # suprime texto de ajuda default do django-filter

79
sapl/static/sapl/css/header-relatorio.css

@ -1,62 +1,49 @@
/* Header CSS for reports (WeasyPrint-friendly) */
html body p { html body p {
border-top: 1px solid black; border-top: 1px solid black;
text-align: center; text-align: center;
font-size: 11pt; font-size: 11pt;
padding: 5px; padding: 5px;
margin-top: -15px; margin-top: -15px;
}
html body section {
box-sizing: border-box;
} }
html body section { box-sizing: border-box; }
html body section dl { html body section dl {
display: flex; /* Keep flex; 'rows' is invalid, drop it. */
flex-wrap: wrap; display: flex;
rows: 2; flex-wrap: wrap;
columns: 2; /* 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 dt { width: 50px; }
html body section dd { html body section dd {
max-width:550px; max-width: 550px;
text-align: center; text-align: center;
} }
html body section dd ul li {
list-style-type: none;
margin-left: 90px;
margin-bottom: -15px;
} html body section dd ul li {
h2 { list-style-type: none;
font-size: 14pt; margin-left: 90px;
} margin-bottom: -15px;
h3 {
font-size: 10pt;
color: #6e6e6e;
}
ul {
padding: 0;
list-style: none;
margin-top:10px;
} }
html body section dt img { h2 { font-size: 14pt; }
max-width:80px;
margin-left: 20px;
margin-left: 50px;
}
h3 { h3 {
font-size: 10pt; font-size: 10pt;
color: #6e6e6e; color: #6e6e6e;
} }
ul { ul {
padding: 0; padding: 0;
list-style: none; list-style: none;
margin-top:10px; margin-top: 10px;
} }
html body section dt img { html body section dt img {
max-width:80px; max-width: 80px;
margin-left: 20px; margin-left: 20px;
} }

131
sapl/static/sapl/css/relatorio.css

@ -1,100 +1,97 @@
@page{ /* Page box */
margin-top: 5.2cm; @page {
size: A4 portrait; /* portrait is default; keep it simple */
size: A4;
margin-top: 5.2cm;
} }
h2.gray-title{ /* Headings */
color: gray; h2.gray-title {
font-size: 14pt; color: gray;
break-after: avoid-page; font-size: 14pt;
page-break-after: avoid; break-after: avoid; /* avoid-page -> avoid */
page-break-after: avoid;
} }
h3 { h3 {
font-size: 10pt; font-size: 10pt;
break-after: avoid-page; break-after: avoid;
page-break-after: avoid; page-break-after: avoid;
} }
p, a { p, a {
font-size: 10pt; font-size: 10pt;
text-align: justify; text-align: justify;
text-justify: inter-word;
} }
/* Fieldset */
fieldset { fieldset {
border: 0; border: 0;
page-break-after: avoid;
margin: 5px;
padding: 0;
} }
html body section { /* Layout */
box-sizing: border-box; html body section { box-sizing: border-box; }
}
html body section dl { html body section dl {
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
columns: 5; column-count: 5;
} }
html body section dt{ html body section dt {
width: 50px; width: 50px;
text-align: left; text-align: left;
} }
html body section dd { html body section dd { text-align: center; }
text-align: center;
}
html body section dd ul li { html body section dd ul li {
list-style-type: none; list-style-type: none;
margin-left: 50px; margin-left: 50px;
} }
fieldset { /* Tables */
page-break-after: avoid; table { table-layout: fixed; max-width: 520px; }
margin:5px;
padding:0px;
}
table {
table-layout: fixed;
max-width: 520px;
}
table.grayTable { table.grayTable {
border: 1px solid #6e6e6e; border: 1px solid #6e6e6e;
width: 100%; width: 100%;
text-align: left; text-align: left;
border-collapse: collapse; border-collapse: collapse;
} }
table.grayTable td, table.grayTable th {
border: 1px solid #000000; table.grayTable td,
padding: 5px; table.grayTable th {
overflow-wrap: break-word; border: 1px solid #000;
word-wrap: break-word; padding: 5px;
text-align: justify; overflow-wrap: break-word;
vertical-align: top; word-wrap: break-word;
text-align: justify;
vertical-align: top;
} }
table.grayTable tbody td { table.grayTable tbody td {
font-size: 10px; font-size: 10px;
max-width: 80px; max-width: 80px;
overflow-wrap: break-word; overflow-wrap: break-word;
word-wrap: break-word; word-wrap: break-word;
text-align: justify; text-align: justify;
}
table.grayTable tr:nth-child(even) {
background: #ffffff;
} }
table.grayTable tr:nth-child(even) { background: #fff; }
table.grayTable thead { table.grayTable thead {
background: #BBBBBB; background: #BBB;
border-bottom: 2px solid #000000; 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; table.grayTable thead th:first-child { border-left: none; }
}

Loading…
Cancel
Save