From 91d4ee2af066b987c298cd89a6f56f7665bd4f3d Mon Sep 17 00:00:00 2001 From: Francesco Filicetti Date: Tue, 21 Feb 2023 15:49:20 +0100 Subject: [PATCH] fix: getting settings value --- publiccode.yml | 4 +-- uniticket/organizational_area/signals.py | 3 +- .../templatetags/organizational_area_tags.py | 9 ++++++ uniticket/uni_ticket/settings.py | 3 +- .../templatetags/uni_ticket_tags.py | 6 ++-- .../templates/form_complete.html | 3 +- .../templates/header_slim_buttons.html | 1 + .../management/statistics_content.html | 2 +- .../templates/management/ticket_detail.html | 7 +++-- .../templates/manager/category_detail.html | 8 +++--- .../ticket_detail_category_conditions.html | 10 +++---- .../templates/ticket_detail_table.html | 18 ++++++------ .../templates/user/closed_ticket.html | 4 +-- .../templates/user/dashboard.html | 4 +-- .../templates/user/opened_ticket.html | 4 +-- .../templates/user/ticket_add_new.html | 28 +++++++++---------- .../templates/user/unassigned_ticket.html | 4 +-- .../templates/user_data.html | 8 +++--- .../uni_ticket_bootstrap_italia_tags.py | 10 +++++++ 19 files changed, 79 insertions(+), 57 deletions(-) diff --git a/publiccode.yml b/publiccode.yml index 60f3e639..b90b4a02 100644 --- a/publiccode.yml +++ b/publiccode.yml @@ -164,10 +164,10 @@ name: uniTicket platforms: - linux - web -releaseDate: '2023-02-17' +releaseDate: '2023-02-21' roadmap: 'https://github.com/UniversitaDellaCalabria/uniTicket/issues' softwareType: standalone/web -softwareVersion: v2.4.0 +softwareVersion: v2.4.1 url: 'https://github.com/UniversitaDellaCalabria/uniTicket' usedBy: - Università della Calabria - https://www.unical.it diff --git a/uniticket/organizational_area/signals.py b/uniticket/organizational_area/signals.py index d08ef2f8..04ea7599 100644 --- a/uniticket/organizational_area/signals.py +++ b/uniticket/organizational_area/signals.py @@ -5,7 +5,8 @@ from django.utils import timezone from django.utils.text import slugify -from organizational_area.settings import DEFAULT_ORGANIZATIONAL_STRUCTURE_OFFICE, DEFAULT_ORGANIZATIONAL_STRUCTURE_OFFICE_DESC +from organizational_area.settings import (DEFAULT_ORGANIZATIONAL_STRUCTURE_OFFICE, + DEFAULT_ORGANIZATIONAL_STRUCTURE_OFFICE_DESC) from . decorators import disable_for_loaddata from . models import (OrganizationalStructure, diff --git a/uniticket/organizational_area/templatetags/organizational_area_tags.py b/uniticket/organizational_area/templatetags/organizational_area_tags.py index 32e0ab14..4d6c88f8 100644 --- a/uniticket/organizational_area/templatetags/organizational_area_tags.py +++ b/uniticket/organizational_area/templatetags/organizational_area_tags.py @@ -1,5 +1,6 @@ from django import template +from organizational_area import settings from organizational_area.models import OrganizationalStructureOfficeEmployee @@ -16,3 +17,11 @@ def employee_offices(user, structure=None): if structure: oe = oe.filter(office__organizational_structure=structure) return oe + + +@register.simple_tag +def organizational_area_settings_value(name, **kwargs): + value = getattr(settings, name, None) + if value and kwargs: + return value.format(**kwargs) + return value diff --git a/uniticket/uni_ticket/settings.py b/uniticket/uni_ticket/settings.py index 9bbc0e46..28c699cf 100644 --- a/uniticket/uni_ticket/settings.py +++ b/uniticket/uni_ticket/settings.py @@ -509,7 +509,8 @@ ] ) -STATS_SHOW_TICKETS_BY_USER = True +STATS_SHOW_TICKETS_BY_USER = getattr( + settings, 'STATS_SHOW_TICKETS_BY_USER', True) PRECOMPILED_TICKET_EXPIRE_DAYS = getattr( settings, 'PRECOMPILED_TICKET_EXPIRE_DAYS', 7) diff --git a/uniticket/uni_ticket/templatetags/uni_ticket_tags.py b/uniticket/uni_ticket/templatetags/uni_ticket_tags.py index 15a26af8..e90466b5 100644 --- a/uniticket/uni_ticket/templatetags/uni_ticket_tags.py +++ b/uniticket/uni_ticket/templatetags/uni_ticket_tags.py @@ -147,10 +147,8 @@ def user_operator_chat(user, structure): @register.simple_tag -def settings_value(name, **kwargs): - value = getattr(settings, name) \ - if hasattr(settings, name) \ - else getattr(uni_ticket_settings, name, None) +def uni_ticket_settings_value(name, **kwargs): + value = getattr(uni_ticket_settings, name, None) if value and kwargs: return value.format(**kwargs) return value diff --git a/uniticket/uni_ticket_bootstrap_italia_template/templates/form_complete.html b/uniticket/uni_ticket_bootstrap_italia_template/templates/form_complete.html index 22766c8a..b9aff08a 100644 --- a/uniticket/uni_ticket_bootstrap_italia_template/templates/form_complete.html +++ b/uniticket/uni_ticket_bootstrap_italia_template/templates/form_complete.html @@ -3,6 +3,7 @@ {% load i18n %} {% load static %} {% load uni_ticket_tags %} +{% load uni_ticket_bootstrap_italia_tags %} {% block top_buttons %} @@ -52,7 +53,7 @@