예제 #1
0
파일: views.py 프로젝트: rhoerbe/ewtishop2
def registration_invoice_finish(request):
	from invoice.models import Invoice
	from bookings.models import BookingLine
	from mailqueue.models import MailerMessage
	from survey.actions import MailSenderParticipantSurvey


	session_invoice_id = request.session['paid_invoice_id']

	invoice = Invoice.objects.get(pk=session_invoice_id)
	receiver = invoice.address.billing_email

	survey_link = None
	billed_participant = invoice.billed_participant()

	context = {'handle': invoice.handle,
		'number': invoice.number,
		'hostname': request.scheme + "://" + request.get_host(),
		'receiver' : receiver,
		'billed_participant': billed_participant,
		}

	if not invoice.mail_sent_at:

		subject = render_to_string('ewtisite/email_invoice_paid/subject.txt', context)
		msg_text = render_to_string('ewtisite/email_invoice_paid/text.txt', context)
		#receiver = invoice.address.billing_email

		new_message = MailerMessage()
		new_message.subject = subject
		new_message.to_address = receiver
		new_message.from_address = settings.EMAIL_SENDER_ADDRESS
		new_message.bcc_address = settings.SHOP_NOTICE_MAILS_TO
		new_message.content = msg_text
		new_message.app = "EWTI Billing"
		new_message.save()

		entered_bookinglines = invoice.bookingline_set.all()
		for bl in entered_bookinglines:
			p = bl.participant

			ms = MailSenderParticipantSurvey()
			ms.context = {
				'participant':p,
				'hostname': request.scheme + "://" + request.get_host(),
				}
			ms.from_address = settings.EMAIL_SENDER_ADDRESS
			ms.bcc_address = settings.SHOP_NOTICE_MAILS_TO
			ms.to_address = p.email
			ms.send()

		invoice.mail_sent_at = datetime.now()
		invoice.save()



	return render(request, 'ewtisite/register_invoice_finish.html', context)
예제 #2
0
파일: admin.py 프로젝트: rhoerbe/ewtishop2
def send_survey_mail(modeladmin,request,queryset):
	
	for p in queryset:
		#print p.rnd_str
		ms = MailSenderParticipantSurvey()
		context = {
				'participant':p,
				'hostname': request.scheme + "://" + request.get_host(),
				}
		ms.context = context
		ms.from_address = settings.EMAIL_SENDER_ADDRESS
		ms.to_address = p.email
		ms.send()