Created BaseEmail class , Now we are sending email to info@ungleich.com after an user book a VM, Fixed pricing issue, Now Admin can changed data about a booked VM
This commit is contained in:
parent
71f3d30549
commit
b443d4d21e
8 changed files with 70 additions and 4 deletions
|
|
@ -1,5 +1,6 @@
|
|||
from django.contrib import admin
|
||||
from .models import VirtualMachineType
|
||||
from .models import VirtualMachineType, VirtualMachinePlan
|
||||
|
||||
|
||||
admin.site.register(VirtualMachineType)
|
||||
admin.site.register(VirtualMachinePlan)
|
||||
|
|
|
|||
Binary file not shown.
|
Before Width: | Height: | Size: 376 B After Width: | Height: | Size: 741 B |
12
hosting/templates/emails/new_booked_vm.html
Normal file
12
hosting/templates/emails/new_booked_vm.html
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
|
||||
<<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title></title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
NEW VM BOOKED
|
||||
|
||||
</body>
|
||||
</html>
|
||||
12
hosting/templates/emails/new_booked_vm.txt
Normal file
12
hosting/templates/emails/new_booked_vm.txt
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
|
||||
<<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title></title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
NEW VM BOOKED
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -29,7 +29,7 @@
|
|||
<ul class="pricing {% cycle 'p-red' 'p-black' 'p-red' 'p-yel' %}">
|
||||
<li class="type">
|
||||
<!-- <img src="http://bread.pp.ua/n/settings_g.svg" alt=""> -->
|
||||
<h3 >{{vm.hosting_company_name}}</h3>
|
||||
<h3 >{{vm.location_code}}</h3>
|
||||
<br/>
|
||||
<img class="img-responsive" src="{{ STATIC_URL }}hosting/img/{{vm.location_code}}_flag.png" alt="">
|
||||
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ from django.contrib import messages
|
|||
from membership.models import CustomUser, StripeCustomer
|
||||
from utils.stripe_utils import StripeUtils
|
||||
from utils.forms import BillingAddressForm
|
||||
from utils.models import BillingAddress
|
||||
from utils.mailer import BaseEmail
|
||||
from .models import VirtualMachineType, VirtualMachinePlan, HostingOrder
|
||||
from .forms import HostingUserSignupForm, HostingUserLoginForm
|
||||
from .mixins import ProcessVMSelectionMixin
|
||||
|
|
@ -174,6 +174,7 @@ class PaymentVMView(LoginRequiredMixin, FormView):
|
|||
context.update({
|
||||
'stripe_key': settings.STRIPE_API_PUBLIC_KEY
|
||||
})
|
||||
|
||||
return context
|
||||
|
||||
def post(self, request, *args, **kwargs):
|
||||
|
|
@ -199,7 +200,7 @@ class PaymentVMView(LoginRequiredMixin, FormView):
|
|||
customer = StripeCustomer.get_or_create(email=self.request.user.email,
|
||||
token=token)
|
||||
if not customer:
|
||||
form.add_error("__all__","Invalid credit card")
|
||||
form.add_error("__all__", "Invalid credit card")
|
||||
return self.render_to_response(self.get_context_data(form=form))
|
||||
|
||||
# Create Virtual Machine Plan
|
||||
|
|
@ -233,6 +234,18 @@ class PaymentVMView(LoginRequiredMixin, FormView):
|
|||
|
||||
# If the Stripe payment was successed, set order status approved
|
||||
order.set_approved()
|
||||
|
||||
# Send notification to ungleich as soon as VM has been booked
|
||||
# TODO send email using celery
|
||||
email_data = {
|
||||
'subject': 'New VM request',
|
||||
'to': 'info@ungleich.ch',
|
||||
'template_name': 'new_booked_vm',
|
||||
'template_path': 'emails/'
|
||||
}
|
||||
email = BaseEmail(**email_data)
|
||||
email.send()
|
||||
|
||||
request.session.update({
|
||||
'charge': charge,
|
||||
'order': order.id,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue