Add try/except protection for ContactSettings before migration
This commit is contained in:
@@ -24,7 +24,13 @@ def site_settings(request):
|
||||
|
||||
def contact_settings(request):
|
||||
"""Context processor для контактных данных"""
|
||||
try:
|
||||
contacts = ContactSettings.get_contacts()
|
||||
return {
|
||||
'contact_settings': contacts,
|
||||
}
|
||||
except:
|
||||
# Если таблица еще не создана (до миграции), вернуть пустой объект
|
||||
return {
|
||||
'contact_settings': None,
|
||||
}
|
||||
|
||||
@@ -326,8 +326,8 @@
|
||||
<i class="fas fa-envelope fa-2x text-primary"></i>
|
||||
</div>
|
||||
<h5 class="card-title fw-bold mb-3">Email</h5>
|
||||
<a href="mailto:{{ contact_settings.email }}" class="text-decoration-none">
|
||||
<p class="card-text text-muted mb-0">{{ contact_settings.email }}</p>
|
||||
<a href="mailto:{{ contact_settings.email|default:'info@smartsoltech.kr' }}" class="text-decoration-none">
|
||||
<p class="card-text text-muted mb-0">{{ contact_settings.email|default:'info@smartsoltech.kr' }}</p>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
@@ -341,8 +341,8 @@
|
||||
<i class="fas fa-phone fa-2x text-success"></i>
|
||||
</div>
|
||||
<h5 class="card-title fw-bold mb-3">Телефон</h5>
|
||||
<a href="tel:{{ contact_settings.phone }}" class="text-decoration-none">
|
||||
<p class="card-text text-muted mb-0">{{ contact_settings.phone }}</p>
|
||||
<a href="tel:{{ contact_settings.phone|default:'+82-10-XXXX-XXXX' }}" class="text-decoration-none">
|
||||
<p class="card-text text-muted mb-0">{{ contact_settings.phone|default:'+82-10-XXXX-XXXX' }}</p>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
@@ -356,15 +356,15 @@
|
||||
<i class="fab fa-telegram-plane fa-2x text-info"></i>
|
||||
</div>
|
||||
<h5 class="card-title fw-bold mb-3">Telegram</h5>
|
||||
<a href="https://t.me/{{ contact_settings.telegram|cut:'@' }}" target="_blank" class="text-decoration-none">
|
||||
<p class="card-text text-muted mb-0">{{ contact_settings.telegram }}</p>
|
||||
<a href="https://t.me/{{ contact_settings.telegram|default:'@smartsoltech'|cut:'@' }}" target="_blank" class="text-decoration-none">
|
||||
<p class="card-text text-muted mb-0">{{ contact_settings.telegram|default:'@smartsoltech' }}</p>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Address Card -->
|
||||
{% if contact_settings.address %}
|
||||
{% if contact_settings.address or not contact_settings %}
|
||||
<div class="col-lg-3 col-md-6">
|
||||
<div class="card h-100 border-0 shadow-sm hover-lift">
|
||||
<div class="card-body text-center p-4">
|
||||
@@ -372,7 +372,7 @@
|
||||
<i class="fas fa-map-marker-alt fa-2x text-warning"></i>
|
||||
</div>
|
||||
<h5 class="card-title fw-bold mb-3">Адрес</h5>
|
||||
<p class="card-text text-muted mb-0">{{ contact_settings.address }}</p>
|
||||
<p class="card-text text-muted mb-0">{{ contact_settings.address|default:'Seoul, South Korea' }}</p>
|
||||
{% if contact_settings.working_hours %}
|
||||
<p class="card-text text-muted small mt-2">{{ contact_settings.working_hours }}</p>
|
||||
{% endif %}
|
||||
|
||||
Reference in New Issue
Block a user