0.8.2
fix articles
This commit is contained in:
@@ -27,4 +27,7 @@ urlpatterns = [
|
|||||||
path('change_profile/', change_profile_ajax, name='change_profile_ajax'),
|
path('change_profile/', change_profile_ajax, name='change_profile_ajax'),
|
||||||
path('change_profile_confirm/', change_profile_confirm_ajax, name='change_profile_confirm_ajax'),
|
path('change_profile_confirm/', change_profile_confirm_ajax, name='change_profile_confirm_ajax'),
|
||||||
path('change_avatar_confirm/', change_avatar_confirm_ajax, name='change_avatar_confirm_ajax'),
|
path('change_avatar_confirm/', change_avatar_confirm_ajax, name='change_avatar_confirm_ajax'),
|
||||||
|
|
||||||
|
path('request_offer/', request_offer_ajax, name='request_offer_ajax')
|
||||||
|
|
||||||
]
|
]
|
||||||
@@ -29,6 +29,44 @@ import base64
|
|||||||
# html = render_to_string('blocks/profile/b_subscribe.html', Dict, request=request)
|
# html = render_to_string('blocks/profile/b_subscribe.html', Dict, request=request)
|
||||||
# return JsonResponse({'html': html}, status=200)
|
# return JsonResponse({'html': html}, status=200)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def request_offer_ajax(request):
|
||||||
|
if request.method != 'POST':
|
||||||
|
raise Http404
|
||||||
|
|
||||||
|
data = request.POST
|
||||||
|
if not data and request.body:
|
||||||
|
data = request.body
|
||||||
|
|
||||||
|
from GeneralApp.funcs_options import get_options_by_opt_types, get_mail_send_options
|
||||||
|
sets = get_options_by_opt_types(['domain', 'project_name'], only_vals=True)
|
||||||
|
|
||||||
|
subject = 'Получен запрос на рекламу'
|
||||||
|
|
||||||
|
Dict = {
|
||||||
|
'logo': f'{sets["domain"]}/static/img/svg/LogoMobile.svg',
|
||||||
|
'project_name': sets['project_name'],
|
||||||
|
'message_title': subject,
|
||||||
|
'message_text': f'<b>ДАННЫЕ ЗАПРОСА</b><br>'
|
||||||
|
f'Имя: {data["name"]}<br>'
|
||||||
|
f'Телефон: {data["phone"]}<br>'
|
||||||
|
}
|
||||||
|
|
||||||
|
html = render_to_string('mail/m_request_offer.html', Dict, request)
|
||||||
|
from BaseModels.mailSender import admin_send_mail_by_SMTPlib
|
||||||
|
mail_sets = get_mail_send_options()
|
||||||
|
to = [mail_sets['sender_email'], 'web@syncsystems.net']
|
||||||
|
res = admin_send_mail_by_SMTPlib(
|
||||||
|
mail_sets,
|
||||||
|
subject=subject,
|
||||||
|
from_email=mail_sets['sender_email'], to=to,
|
||||||
|
html_content=html
|
||||||
|
)
|
||||||
|
|
||||||
|
return JsonResponse('OK')
|
||||||
|
|
||||||
|
|
||||||
@login_required(login_url='/profile/login/')
|
@login_required(login_url='/profile/login/')
|
||||||
def chats_ajax(request):
|
def chats_ajax(request):
|
||||||
if request.method != 'POST':
|
if request.method != 'POST':
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ def admin_send_mail_by_SMTPlib(sets, subject, from_email, to, html_content, atta
|
|||||||
smtp_port = sets['mail_server_smtp_port']
|
smtp_port = sets['mail_server_smtp_port']
|
||||||
smtp_password = sets['sender_mail_password']
|
smtp_password = sets['sender_mail_password']
|
||||||
smtp_login = sets['sender_mail_login']
|
smtp_login = sets['sender_mail_login']
|
||||||
res = send_mail_by_SMTPlib(subject, from_email, to, html_content, smtp_server, smtp_port, smtp_login,
|
res = send_mail_by_SMTPlib(sets, subject, from_email, to, html_content, smtp_server, smtp_port, smtp_login,
|
||||||
smtp_password, attachments)
|
smtp_password, attachments)
|
||||||
|
|
||||||
|
|
||||||
@@ -106,14 +106,14 @@ def admin_send_mail_by_SMTPlib(sets, subject, from_email, to, html_content, atta
|
|||||||
def send_mail_by_SMTPlib(sets, subject, from_email, to_init, html_content, smtp_server, smtp_port, smtp_login, smtp_password,
|
def send_mail_by_SMTPlib(sets, subject, from_email, to_init, html_content, smtp_server, smtp_port, smtp_login, smtp_password,
|
||||||
attachments=None):
|
attachments=None):
|
||||||
to = to_init
|
to = to_init
|
||||||
if not settings.prod_server:
|
# if not settings.prod_server:
|
||||||
to = 'web@syncsystems.net'
|
# to = 'web@syncsystems.net'
|
||||||
else:
|
# else:
|
||||||
to = to_init
|
# to = to_init
|
||||||
try:
|
# try:
|
||||||
from settings_local import DEBUG
|
# from settings_local import DEBUG
|
||||||
except:
|
# except:
|
||||||
print('get settings_local fail')
|
# print('get settings_local fail')
|
||||||
|
|
||||||
res = None
|
res = None
|
||||||
mail_lib = None
|
mail_lib = None
|
||||||
@@ -153,8 +153,8 @@ def send_mail_by_SMTPlib(sets, subject, from_email, to_init, html_content, smtp_
|
|||||||
else:
|
else:
|
||||||
to_str = to[0]
|
to_str = to[0]
|
||||||
else:
|
else:
|
||||||
if to == sets['sender_email']:
|
# if to == sets['sender_email']:
|
||||||
return None
|
# return None
|
||||||
to_str = to
|
to_str = to
|
||||||
to = []
|
to = []
|
||||||
to.append(to_str)
|
to.append(to_str)
|
||||||
|
|||||||
@@ -10,8 +10,8 @@ def get_options_by_opt_types(opt_types, only_vals=False):
|
|||||||
|
|
||||||
opts = Option.objects.filter(**kwargs)
|
opts = Option.objects.filter(**kwargs)
|
||||||
if opts and only_vals:
|
if opts and only_vals:
|
||||||
opts = opts.values('name', 'value')
|
opts = opts.values('opt_type', 'value')
|
||||||
opts = {item['name']: item['value'] for item in opts}
|
opts = {item['opt_type']: item['value'] for item in opts}
|
||||||
return opts
|
return opts
|
||||||
|
|
||||||
def get_first_option_value_by_opt_type(opt_type):
|
def get_first_option_value_by_opt_type(opt_type):
|
||||||
|
|||||||
65
templates/mail/m_request_offer.html
Normal file
65
templates/mail/m_request_offer.html
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
|
||||||
|
<div style="font-family:Calibri,Candara,Segoe,'Segoe UI',Optima,Arial,sans-serif;padding:10px;">
|
||||||
|
<div style="line-height:1.0em;width: 660px">
|
||||||
|
<div style="background-color: #F8F8F8;padding:5px">
|
||||||
|
<img src="{{ logo }}" alt="{{ project_name }}" style="margin:0;padding:0;">
|
||||||
|
</div>
|
||||||
|
<p style="font-weight:700;font-size:25px;text-align:center;padding:0;line-height:1em">
|
||||||
|
{{ message_title|safe }}
|
||||||
|
</p>
|
||||||
|
<div style="line-height:1.0em;font-size:18px;margin-top: 5px; margin-left: 30px">
|
||||||
|
{# <p style="line-height:1.0em;font-size:18px;margin-top: 5px; margin-left: 80px">#}
|
||||||
|
{{ message_text|safe }}
|
||||||
|
{# </p>#}
|
||||||
|
</div>
|
||||||
|
{% for button in message_buttons %}
|
||||||
|
<div style="text-align:center;font-weight: 700;">
|
||||||
|
<a href="{{ button.url }}">
|
||||||
|
<div style="display:inline-block;text-align:center;font-size:18px;padding:5px 10px;margin:5px;border-radius:2px;background-color:#61aeb6;color:#fff;text-decoration:none;line-height:1.0em;cursor:pointer">
|
||||||
|
{{ button.caption }}
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
{% endfor %}
|
||||||
|
|
||||||
|
|
||||||
|
<div style="text-align:center;width: 660px;line-height:1.1em">
|
||||||
|
<div style="margin: 40px 10px 10px;">
|
||||||
|
<hr>
|
||||||
|
{# <nobr><b>Адрес кафе:</b> Минск, ул. Будславская, 2</nobr>#}
|
||||||
|
{# <br>#}
|
||||||
|
{# <nobr><b>График работы:</b> пн-вс 12:00 - 24:00</nobr>#}
|
||||||
|
{# <br>#}
|
||||||
|
{# <nobr><b>Телефоны кафе:</b> +375 44 77 321 77</nobr>#}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div style="text-align: center;margin-top:5px">
|
||||||
|
{# <a href="https://baldenini.by/event/dostavka-edy" style="text-decoration: none;">#}
|
||||||
|
{# <div style="color: #311A12;#}
|
||||||
|
{# padding: 10px;#}
|
||||||
|
{# margin: 5px 10px 0 10px;#}
|
||||||
|
{# border: 2px solid #311A12;#}
|
||||||
|
{# border-radius: 5px;#}
|
||||||
|
{# font-size: 20px;#}
|
||||||
|
{# display: inline-block;#}
|
||||||
|
{# font-weight: 700;#}
|
||||||
|
{# text-transform: uppercase;">О ДОСТАВКЕ#}
|
||||||
|
{# </div>#}
|
||||||
|
{# </a>#}
|
||||||
|
{# <a href="https://baldenini.by/page/baldenini-cafe-o-nas" style="text-decoration: none;">#}
|
||||||
|
{# <div style="color: #311A12;#}
|
||||||
|
{# padding: 10px;#}
|
||||||
|
{# margin: 5px 10px 0 10px;#}
|
||||||
|
{# border: 2px solid #311A12;#}
|
||||||
|
{# border-radius: 5px;#}
|
||||||
|
{# font-size: 20px;#}
|
||||||
|
{# display: inline-block;#}
|
||||||
|
{# font-weight: 700;#}
|
||||||
|
{# text-transform: uppercase;">О BALDENINI CAFE#}
|
||||||
|
{# </div>#}
|
||||||
|
{# </a>#}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
@@ -44,7 +44,7 @@
|
|||||||
|
|
||||||
<div class="news_item_static">
|
<div class="news_item_static">
|
||||||
|
|
||||||
<div class="news_img"><img src="{{ MEDIA_URL }} {{ page.picture }}" /></div>
|
<div class="news_img"><img src="{{ MEDIA_URL }}{{ page.picture }}" /></div>
|
||||||
<div class="news_header">{{ page.name }}</div>
|
<div class="news_header">{{ page.name }}</div>
|
||||||
<div class="news_description">
|
<div class="news_description">
|
||||||
{{ page.description|truncatechars:100 }}
|
{{ page.description|truncatechars:100 }}
|
||||||
|
|||||||
Reference in New Issue
Block a user