From 28a00680e52de627eeaef7c6242b81708596330d Mon Sep 17 00:00:00 2001 From: SDE Date: Sat, 9 Dec 2023 21:03:09 +0300 Subject: [PATCH] 0.3.4 contacts page --- GeneralApp/admin.py | 3 ++- GeneralApp/urls.py | 1 + GeneralApp/views.py | 11 +++++++++++ templates/pages/p_contacts.html | 29 +++++++++++++++++++++++++++++ 4 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 templates/pages/p_contacts.html diff --git a/GeneralApp/admin.py b/GeneralApp/admin.py index 8dc6c7f..f3555b0 100644 --- a/GeneralApp/admin.py +++ b/GeneralApp/admin.py @@ -249,9 +249,10 @@ class Admin_Office(Admin_Trans_BaseModelViewPage): # 'main_office', 'city', 'address', + 'picture', ( 'work_time_from', 'work_time_to', - # 'workTime', + 'workTime', ), # ('legal_name', 'unp', 'legal_address', 'urInfo'), # 'fullContactInfo', diff --git a/GeneralApp/urls.py b/GeneralApp/urls.py index 93dc521..a009b5c 100644 --- a/GeneralApp/urls.py +++ b/GeneralApp/urls.py @@ -6,6 +6,7 @@ from .views import * urlpatterns = [ path('', MainPage, name='main'), + path('contacts/', contacts_view, name='contacts'), path('page//', StaticPageView, name='static_page'), path('test_code', test_code, name='test_code'), ] \ No newline at end of file diff --git a/GeneralApp/views.py b/GeneralApp/views.py index 95152ef..971220a 100644 --- a/GeneralApp/views.py +++ b/GeneralApp/views.py @@ -92,3 +92,14 @@ def StaticPageView(request, url): # return HttpResponse(t.render(Dict, request)) +def contacts_view(request): + # from RoutesApp.forms import RouteForm + # from SubscribesApp.funcs import get_subsribes_w_options + + Dict = { + 'offices': Office.objects.filter(enable=True) + } + + t = loader.get_template('pages/p_contacts.html') + return get_inter_http_respose(t, Dict, request) + # return HttpResponse(t.render(Dict, request)) diff --git a/templates/pages/p_contacts.html b/templates/pages/p_contacts.html new file mode 100644 index 0000000..42c8f10 --- /dev/null +++ b/templates/pages/p_contacts.html @@ -0,0 +1,29 @@ +{% extends 'tb_base.html' %} +{% block CONTENT %} + +
+ Контакты +
+ {% for office in offices %} +
+ {% if office.picture %} + {{ office.city }} + {% endif %} +
{{ office.city }}
+
{{ office.address }}
+ Часы работы: +
{{ office.work_time_from }} - {{ office.work_time_to }}
+
{{ office.work_time }}
+
+ {% for contact in office.contacts %} +
+ {% if contact.contact_label %}{{ contact.contact_label }}: {% endif %}{{ contact.get_prefix_w_data }} +
+ {% endfor %} +
+
+ {% endfor %} +
+
+ +{% endblock %} \ No newline at end of file