From 082b3ade72d314132137593824c19c771f1e3cdf Mon Sep 17 00:00:00 2001 From: "Andrew K. Choi" Date: Mon, 24 Nov 2025 15:29:29 +0900 Subject: [PATCH] Add try/except protection for ContactSettings before migration --- smartsoltech/web/context_processors.py | 14 ++++++++++---- smartsoltech/web/templates/web/about_modern.html | 16 ++++++++-------- 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/smartsoltech/web/context_processors.py b/smartsoltech/web/context_processors.py index 8aeebbe..cd68eab 100644 --- a/smartsoltech/web/context_processors.py +++ b/smartsoltech/web/context_processors.py @@ -24,7 +24,13 @@ def site_settings(request): def contact_settings(request): """Context processor для контактных данных""" - contacts = ContactSettings.get_contacts() - return { - 'contact_settings': contacts, - } + try: + contacts = ContactSettings.get_contacts() + return { + 'contact_settings': contacts, + } + except: + # Если таблица еще не создана (до миграции), вернуть пустой объект + return { + 'contact_settings': None, + } diff --git a/smartsoltech/web/templates/web/about_modern.html b/smartsoltech/web/templates/web/about_modern.html index 54ba511..6647dc8 100644 --- a/smartsoltech/web/templates/web/about_modern.html +++ b/smartsoltech/web/templates/web/about_modern.html @@ -326,8 +326,8 @@
Email
- -

{{ contact_settings.email }}

+
+

{{ contact_settings.email|default:'info@smartsoltech.kr' }}

@@ -341,8 +341,8 @@
Телефон
- -

{{ contact_settings.phone }}

+
+

{{ contact_settings.phone|default:'+82-10-XXXX-XXXX' }}

@@ -356,15 +356,15 @@
Telegram
- -

{{ contact_settings.telegram }}

+
+

{{ contact_settings.telegram|default:'@smartsoltech' }}

- {% if contact_settings.address %} + {% if contact_settings.address or not contact_settings %}
@@ -372,7 +372,7 @@
Адрес
-

{{ contact_settings.address }}

+

{{ contact_settings.address|default:'Seoul, South Korea' }}

{% if contact_settings.working_hours %}

{{ contact_settings.working_hours }}

{% endif %}