From 2fa01108d838288a33f5b25b12a1db658a33e0d4 Mon Sep 17 00:00:00 2001 From: Laurent Date: Thu, 5 Jun 2025 10:19:57 +0200 Subject: [PATCH 1/5] fix crash --- tournaments/models/tournament.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tournaments/models/tournament.py b/tournaments/models/tournament.py index c9868ac..86c380d 100644 --- a/tournaments/models/tournament.py +++ b/tournaments/models/tournament.py @@ -594,7 +594,7 @@ class Tournament(BaseModel): first_match = min(valid_matches, key=lambda match: match.start_date) # Format the date - timezone = first_match.tournament().timezone() + timezone = first_match.get_tournament().timezone() local_start = first_match.start_date.astimezone(timezone) time_format = 'l d M' formatted_schedule = f" - {formats.date_format(local_start, format=time_format)}" From 26ee2e49d08b10d93f312c7a5d56c4c29d9af612 Mon Sep 17 00:00:00 2001 From: Laurent Date: Thu, 5 Jun 2025 15:38:58 +0200 Subject: [PATCH 2/5] sets daily rotating log files --- padelclub_backend/settings.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/padelclub_backend/settings.py b/padelclub_backend/settings.py index 31e51fb..0cd7d5a 100644 --- a/padelclub_backend/settings.py +++ b/padelclub_backend/settings.py @@ -189,8 +189,11 @@ LOGGING = { }, 'file': { 'level': 'DEBUG', - 'class': 'logging.FileHandler', - 'filename': os.path.join(BASE_DIR, 'django.log'), + 'class': 'logging.handlers.TimedRotatingFileHandler', + 'filename': os.path.join(BASE_DIR, 'logs', 'django.log'), + 'when': 'midnight', + 'interval': 1, + 'backupCount': 30, 'formatter': 'verbose', }, 'rotating_file': { From 99be99019bd7606d78720a886731e10f6b97f00a Mon Sep 17 00:00:00 2001 From: Laurent Date: Thu, 5 Jun 2025 16:00:16 +0200 Subject: [PATCH 3/5] fix log --- padelclub_backend/settings.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/padelclub_backend/settings.py b/padelclub_backend/settings.py index 0cd7d5a..31e51fb 100644 --- a/padelclub_backend/settings.py +++ b/padelclub_backend/settings.py @@ -189,11 +189,8 @@ LOGGING = { }, 'file': { 'level': 'DEBUG', - 'class': 'logging.handlers.TimedRotatingFileHandler', - 'filename': os.path.join(BASE_DIR, 'logs', 'django.log'), - 'when': 'midnight', - 'interval': 1, - 'backupCount': 30, + 'class': 'logging.FileHandler', + 'filename': os.path.join(BASE_DIR, 'django.log'), 'formatter': 'verbose', }, 'rotating_file': { From 70f4f343aa96cafd95e4522123dc7fb0e9862979 Mon Sep 17 00:00:00 2001 From: Laurent Date: Thu, 5 Jun 2025 16:13:31 +0200 Subject: [PATCH 4/5] fix logs --- padelclub_backend/settings.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/padelclub_backend/settings.py b/padelclub_backend/settings.py index 31e51fb..4859194 100644 --- a/padelclub_backend/settings.py +++ b/padelclub_backend/settings.py @@ -168,6 +168,9 @@ AUTHENTICATION_BACKENDS = [ CSRF_COOKIE_SECURE = True # if using HTTPS SESSION_COOKIE_SECURE = True +LOGS_DIR = os.path.join(BASE_DIR, 'logs') +os.makedirs(LOGS_DIR, exist_ok=True) + LOGGING = { 'version': 1, 'disable_existing_loggers': False, @@ -196,7 +199,7 @@ LOGGING = { 'rotating_file': { 'level': 'INFO', 'class': 'logging.handlers.RotatingFileHandler', - 'filename': os.path.join(BASE_DIR, 'django.log'), + 'filename': os.path.join(LOGS_DIR, 'django.log'), 'maxBytes': 10 * 1024 * 1024, 'backupCount': 10, 'formatter': 'verbose', From 28f89d3ca8054aabb701b54541b083a9ec669700 Mon Sep 17 00:00:00 2001 From: Laurent Date: Thu, 5 Jun 2025 17:54:36 +0200 Subject: [PATCH 5/5] remove data_access_ids from the admin --- sync/admin.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sync/admin.py b/sync/admin.py index 16d3c77..cb97d80 100644 --- a/sync/admin.py +++ b/sync/admin.py @@ -4,6 +4,9 @@ from django.utils import timezone from .models import BaseModel, ModelLog, DataAccess class SyncedObjectAdmin(admin.ModelAdmin): + + exclude = ('data_access_ids',) + def save_model(self, request, obj, form, change): if isinstance(obj, BaseModel): obj.last_updated_by = request.user