本文整理汇总了Python中nnmware.core.utils.send_template_mail函数的典型用法代码示例。如果您正苦于以下问题:Python send_template_mail函数的具体用法?Python send_template_mail怎么用?Python send_template_mail使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了send_template_mail函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: booking_new_sysadm_mail
def booking_new_sysadm_mail(booking):
recipients = settings.BOOKING_MANAGERS
mail_dict = {'booking': booking,
'site_name': settings.SITENAME}
subject = 'booking/on_create_to_sysadm_subject.txt'
body = 'booking/on_create_to_sysadm.txt'
send_template_mail(subject, body, mail_dict, recipients)
示例2: handle
def handle(self, *args, **options):
activate('ru')
for hotel in Hotel.objects.exclude(admins=None).exclude(work_on_request=True):
result = []
all_users = []
for room in hotel.room_set.all():
avail = Availability.objects.filter(room=room, date__range=(
now(), now() + timedelta(days=13))).count()
if avail < 14:
avail_err = [room.get_name, _('Not filled availability')]
result.append(avail_err)
for settlement in SettlementVariant.objects.filter(room=room, enabled=True):
if settlement.current_amount() is 0:
settlement_err = [room.get_name,
_('Not filled price for %s-placed settlement') % settlement.settlement]
result.append(settlement_err)
if len(result) > 0:
if len(hotel.email) > 0:
all_users.append(hotel.email)
if len(hotel.contact_email) > 0:
all_users.append(hotel.contact_email)
recipients = all_users # settings.BOOKING_MANAGERS
mail_dict = {'hotel_name': hotel.get_name, 'site_name': settings.SITENAME, 'items': result}
subject = 'booking/err_hotel_subject.txt'
body = 'booking/err_hotel.txt'
send_template_mail(subject, body, mail_dict, recipients)
示例3: booking_new_client_mail
def booking_new_client_mail(booking, username=''):
if booking.email:
recipients = [booking.email]
mail_dict = {'booking': booking,
'site_name': settings.SITENAME, 'username': username}
subject = 'booking/on_create_to_client_subject.txt'
body = 'booking/on_create_to_client.txt'
send_template_mail(subject,body,mail_dict,recipients)
示例4: new_order
def new_order(request):
# Link used when User make order
try:
if not request.user.is_authenticated():
raise AccessError
if not check_basket(request.user):
raise BasketError
addr = request.POST.get('addr')
address = DeliveryAddress.objects.get(user=request.user, pk=int(addr))
order = Order()
order.address = str(address)
order.first_name = address.first_name
order.middle_name = address.middle_name
order.last_name = address.last_name
order.user = request.user
order.name = ''
order.comment = ''
order.status = STATUS_WAIT
order.save()
basket = Basket.objects.filter(user=request.user)
for item in basket:
order_item = OrderItem()
order_item.order = order
order_item.product_name = item.product.name
order_item.product_origin = item.product
order_item.product_url = item.product.get_absolute_url
order_item.amount = item.product.amount
order_item.product_pn = item.product.shop_pn
order_item.quantity = item.quantity
order_item.save()
item.product.quantity -= item.quantity
item.product.save()
basket.delete()
recipients = [settings.SHOP_MANAGER]
mail_dict = {'order': order}
subject = 'emails/neworder_admin_subject.txt'
body = 'emails/neworder_admin_body.txt'
send_template_mail(subject,body,mail_dict,recipients)
try:
recipients = [request.user.email]
mail_dict = {'order': order}
subject = 'emails/neworder_client_subject.txt'
body = 'emails/neworder_client_body.txt'
send_template_mail(subject,body,mail_dict,recipients)
except:
pass
payload = {'success': True,'id':order.pk, 'location':order.get_absolute_url()}
except AccessError:
payload = {'success': False}
except BasketError:
payload = {'success': False, 'message':_('Product in basket not available')}
except:
payload = {'success': False}
return AjaxLazyAnswer(payload)
示例5: form_valid
def form_valid(self, form):
new_pw = form.cleaned_data.get('new_password2')
self.request.user.set_password(new_pw)
self.request.user.save()
try:
recipients = [self.request.user.email]
mail_dict = {'new_pw': new_pw}
subject = 'emails/changepass_client_subject.txt'
body = 'emails/changepass_client_body.txt'
send_template_mail(subject, body, mail_dict, recipients)
except:
pass
return super(ChangePasswordView, self).form_valid(form)
示例6: booking_new_hotel_mail
def booking_new_hotel_mail(booking):
hotel_recipients = []
if booking.hotel.email:
hotel_recipients.append(booking.hotel.email)
elif booking.hotel.contact_email:
hotel_recipients.append(booking.hotel.contact_email)
for admin in booking.hotel.admins.all():
if admin.email:
hotel_recipients.append(admin.email)
mail_dict = {'booking': booking, 'site_name': SITENAME}
subject = 'booking/on_create_to_hotel_subject.txt'
body = 'booking/on_create_to_hotel.txt'
send_template_mail(subject, body, mail_dict, hotel_recipients)
示例7: push_answer
def push_answer(request,object_id):
try:
f = Feedback.objects.get(pk=int(object_id))
f.answer = request.POST.get('answer')
recipients = [f.email]
mail_dict = {'feedback': f}
subject = 'emails/feedback_answer_subject.txt'
body = 'emails/feedback_answer_body.txt'
send_template_mail(subject,body,mail_dict,recipients)
f.save()
payload = {'success': True, 'location': f.get_absolute_url()}
except :
payload = {'success': False}
return AjaxLazyAnswer(payload)
示例8: push_answer
def push_answer(request, object_id):
try:
f = Feedback.objects.get(pk=int(object_id))
f.answer = request.POST.get("answer")
recipients = [f.email]
mail_dict = {"feedback": f}
subject = "emails/feedback_answer_subject.txt"
body = "emails/feedback_answer_body.txt"
send_template_mail(subject, body, mail_dict, recipients)
f.save()
payload = {"success": True, "location": f.get_absolute_url()}
except:
payload = {"success": False}
return AjaxLazyAnswer(payload)
示例9: form_valid
def form_valid(self, form):
self.object = form.save(commit=False)
self.object.save()
try:
recipients = [self.request.user.email]
mail_dict = {'order': self.object}
if self.object.status == STATUS_PROCESS:
subject = 'emails/status_process_subject.txt'
body = 'emails/status_process_body.txt'
if self.object.status == STATUS_SENT:
subject = 'emails/status_sent_subject.txt'
body = 'emails/status_sent_body.txt'
send_template_mail(subject,body,mail_dict,recipients)
except:
pass
return super(OrderStatusChange, self).form_valid(form)
示例10: push_shopcallback
def push_shopcallback(request):
"""
Its Ajax posted shop callback
"""
try:
cb = ShopCallback()
cb.ip = request.META["REMOTE_ADDR"]
cb.user_agent = request.META["HTTP_USER_AGENT"]
cb.clientname = request.POST.get("clientname")
cb.clientphone = request.POST.get("clientphone")
cb.save()
mail_dict = {"callback": cb}
recipients = [settings.SHOP_MANAGER]
subject = "emails/callback_admin_subject.txt"
body = "emails/callback_admin_body.txt"
send_template_mail(subject, body, mail_dict, recipients)
payload = {"success": True}
except:
payload = {"success": False}
return AjaxLazyAnswer(payload)
示例11: form_valid
def form_valid(self, form):
email = form.cleaned_data.get('email')
username = form.cleaned_data.get('username')
password = form.cleaned_data.get('password2')
try:
e = EmailValidation.objects.get(email=email)
except :
e = EmailValidation()
e.username = username
e.email = email
e.password = password
e.created = datetime.now()
e.key = make_key(username)
e.save()
mail_dict = {'key': e.key,
'expiration_days': settings.ACCOUNT_ACTIVATION_DAYS,
'site_name': settings.SITENAME, 'email': email}
subject = 'registration/activation_subject.txt'
body = 'registration/activation.txt'
send_template_mail(subject,body,mail_dict,[e.email])
return super(SignupView, self).form_valid(form)
示例12: push_quickorder
def push_quickorder(request):
"""
Its Ajax posted shop quick order
"""
try:
cb = ShopCallback()
cb.ip = request.META['REMOTE_ADDR']
cb.user_agent = request.META['HTTP_USER_AGENT']
cb.clientname = request.POST.get('clientname')
cb.clientphone = request.POST.get('clientphone')
cb.description = request.POST.get('product_url')
cb.quickorder = True
cb.save()
mail_dict = {'callback': cb}
recipients = [settings.SHOP_MANAGER]
subject = 'emails/quickorder_admin_subject.txt'
body = 'emails/quickorder_admin_body.txt'
send_template_mail(subject, body, mail_dict, recipients)
payload = {'success': True}
except:
payload = {'success': False}
return ajax_answer_lazy(payload)
示例13: handle
def handle(self, *args, **options):
activate("ru")
for hotel in Hotel.objects.exclude(admins=None):
result = []
for room in hotel.room_set.all():
avail = Availability.objects.filter(
room=room, date__range=(datetime.now(), datetime.now() + timedelta(days=13))
).count()
if avail < 14:
avail_err = [room.get_name, _("Not filled availability")]
result.append(avail_err)
for settlement in SettlementVariant.objects.filter(room=room, enabled=True):
if settlement.current_amount() is 0:
settlement_err = [
room.get_name,
_("Not filled price for %s-placed settlement") % settlement.settlement,
]
result.append(settlement_err)
if len(result) > 0:
recipients = settings.BOOKING_MANAGERS
mail_dict = {"hotel_name": hotel.get_name, "site_name": settings.SITENAME, "items": result}
subject = "booking/err_hotel_subject.txt"
body = "booking/err_hotel.txt"
send_template_mail(subject, body, mail_dict, recipients)
示例14: request_add_hotel_mail
def request_add_hotel_mail(req_add):
recipients = settings.BOOKING_MANAGERS
mail_dict = {'req_add': req_add, 'site_name': settings.SITENAME}
subject = 'booking/request_add_hotel_subject.txt'
body = 'booking/request_add_hotel.txt'
send_template_mail(subject,body,mail_dict,recipients)
示例15: send_new_order_buyer
def send_new_order_buyer(order, recipients):
mail_dict = {'order': order}
subject = 'emails/neworder_client_subject.txt'
body = 'emails/neworder_client_body.txt'
send_template_mail(subject, body, mail_dict, recipients)