Here are the examples of the python api django.forms.InvoiceEmailForm taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
1 Examples
0
View Complete Implementation : views.py
Copyright Apache License 2.0
Author : chrisjrn
Copyright Apache License 2.0
Author : chrisjrn
@user_pastes_test(_staff_only)
def invoice_mailout(request):
''' Allows staff to send emails to users based on their invoice status. '''
category = request.GET.getlist("category", [])
product = request.GET.getlist("product", [])
status = request.GET.get("status")
form = forms.InvoiceEmailForm(
request.POST or None,
category=category,
product=product,
status=status,
)
emails = []
if form.is_valid():
emails = []
for invoice in form.cleaned_data["invoice"]:
# datatuple = (subject, message, from_email, recipient_list)
from_email = form.cleaned_data["from_email"]
subject = form.cleaned_data["subject"]
body = Template(form.cleaned_data["body"]).render(
Context({
"invoice": invoice,
"user": invoice.user,
})
)
recipient_list = [invoice.user.email]
emails.append(Email(subject, body, from_email, recipient_list))
if form.cleaned_data["action"] == forms.InvoiceEmailForm.ACTION_SEND:
# Send e-mails *ONLY* if we're sending.
send_mast_mail(emails)
messages.info(request, "The e-mails have been sent.")
data = {
"form": form,
"emails": emails,
}
return render(request, "registrasion/invoice_mailout.html", data)