From 34bc835a224cc51c202f4c8edeced2b645b8b795 Mon Sep 17 00:00:00 2001 From: Diego Cirilo Date: Wed, 3 Dec 2025 23:53:09 -0300 Subject: [PATCH 1/5] =?UTF-8?q?depend=C3=AAncias=20do=20weasyprint?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Dockerfile b/Dockerfile index 787c639..6e004be 100644 --- a/Dockerfile +++ b/Dockerfile @@ -35,9 +35,16 @@ WORKDIR /app # Install runtime dependencies only RUN apt-get update && apt-get install -y \ postgresql-client \ + # weasyprint dependencies + libpango-1.0-0 libpangoft2-1.0-0 libharfbuzz-subset0 \ + locales \ libpq5 \ && rm -rf /var/lib/apt/lists/* +RUN sed -i '/pt_BR.UTF-8/s/^# //g' /etc/locale.gen && \ + locale-gen pt_BR.UTF-8 && \ + update-locale LANG=pt_BR.UTF-8 + # Copy Python dependencies from builder COPY --from=builder /usr/local/lib/python3.11/site-packages /usr/local/lib/python3.11/site-packages COPY --from=builder /usr/local/bin /usr/local/bin From 1e215057a6a702bd5e062dbe752496cf24ab2143 Mon Sep 17 00:00:00 2001 From: Diego Cirilo Date: Thu, 4 Dec 2025 00:13:09 -0300 Subject: [PATCH 2/5] htmx pras views de lista/filtro/sort --- core/views.py | 6 ++++ templates/core/includes/list_content.html | 41 +++++++++++++++++++++++ templates/core/list.html | 39 ++------------------- templates/django_tables2/bootstrap5.html | 8 ++--- 4 files changed, 53 insertions(+), 41 deletions(-) create mode 100644 templates/core/includes/list_content.html diff --git a/core/views.py b/core/views.py index 70a0c00..233898a 100644 --- a/core/views.py +++ b/core/views.py @@ -25,6 +25,7 @@ class CoreFilterView( FilterView, ): template_name = "core/list.html" + template_name_htmx = "core/includes/list_content.html" permission_action = "view" paginate_by = None table_pagination = {"per_page": 10} @@ -32,6 +33,11 @@ class CoreFilterView( def get_table_data(self): return self.object_list + def get_template_names(self): + if self.request.htmx: + return [self.template_name_htmx] + return [self.template_name] + class CoreDetailView( CoreBaseMixin, diff --git a/templates/core/includes/list_content.html b/templates/core/includes/list_content.html new file mode 100644 index 0000000..957aac3 --- /dev/null +++ b/templates/core/includes/list_content.html @@ -0,0 +1,41 @@ +{% load render_table from django_tables2 %} +{% load filter_tags %} + +{% if filter %} +{% has_active_filters filter as filters_active %} +
+
+
+
+ {% for field in filter.form %} + {% if field.name != 'csrfmiddlewaretoken' %} +
+ + {{ field }} + {% if field.errors %} +
+ {{ field.errors }} +
+ {% endif %} +
+ {% endif %} + {% endfor %} +
+ + + Limpar + +
+
+
+
+
+{% endif %} + +
+
+ {% render_table table %} +
+
diff --git a/templates/core/list.html b/templates/core/list.html index 80af489..96d47e3 100644 --- a/templates/core/list.html +++ b/templates/core/list.html @@ -36,43 +36,8 @@ - {% if filter %} - {% has_active_filters filter as filters_active %} -
-
-
-
- {% for field in filter.form %} - {% if field.name != 'csrfmiddlewaretoken' %} -
- - {{ field }} - {% if field.errors %} -
- {{ field.errors }} -
- {% endif %} -
- {% endif %} - {% endfor %} -
- - - Limpar - -
-
-
-
-
- {% endif %} - -
-
- {% render_table table %} -
+
+ {% include "core/includes/list_content.html" %}
{% endblock %} diff --git a/templates/django_tables2/bootstrap5.html b/templates/django_tables2/bootstrap5.html index ac66365..3ebc6bc 100644 --- a/templates/django_tables2/bootstrap5.html +++ b/templates/django_tables2/bootstrap5.html @@ -10,7 +10,7 @@ {% for column in table.columns %} {% if column.orderable %} - + {{ column.header }} {% if column.is_ordered %} {% if column.order_by_alias.next == column.name %} @@ -85,7 +85,7 @@