fix articles
This commit is contained in:
SDE
2023-11-30 07:41:22 +03:00
parent dcfd66324e
commit de098bdf55
6 changed files with 120 additions and 14 deletions

View File

@@ -27,4 +27,7 @@ urlpatterns = [
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_avatar_confirm/', change_avatar_confirm_ajax, name='change_avatar_confirm_ajax'),
path('request_offer/', request_offer_ajax, name='request_offer_ajax')
]

View File

@@ -29,6 +29,44 @@ import base64
# html = render_to_string('blocks/profile/b_subscribe.html', Dict, request=request)
# 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/')
def chats_ajax(request):
if request.method != 'POST':