Resolved some conflicts
This commit is contained in:
commit
92fb72197d
2 changed files with 49 additions and 1 deletions
|
@ -1,6 +1,6 @@
|
||||||
from django.conf.urls import url
|
from django.conf.urls import url
|
||||||
|
|
||||||
from .views import IndexView, BetaProgramView, LandingProgramView, BetaAccessView, PricingView
|
from .views import IndexView, BetaProgramView, LandingProgramView, BetaAccessView, PricingView, SuccessView
|
||||||
|
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
|
|
|
@ -103,6 +103,54 @@ class PricingView(TemplateView):
|
||||||
|
|
||||||
return render(self.request, 'datacenterlight/success.html', {})
|
return render(self.request, 'datacenterlight/success.html', {})
|
||||||
|
|
||||||
|
class OrderView(TemplateView):
|
||||||
|
template_name = "datacenterlight/order.html"
|
||||||
|
|
||||||
|
def get(self, request, *args, **kwargs):
|
||||||
|
try:
|
||||||
|
manager = OpenNebulaManager()
|
||||||
|
templates = manager.get_templates()
|
||||||
|
|
||||||
|
context = {
|
||||||
|
'templates': VirtualMachineTemplateSerializer(templates, many=True).data,
|
||||||
|
}
|
||||||
|
except:
|
||||||
|
messages.error( request,
|
||||||
|
'We could not load the VM templates due to a backend connection \
|
||||||
|
error. Please try again in a few minutes'
|
||||||
|
)
|
||||||
|
context = {
|
||||||
|
'error' : 'connection'
|
||||||
|
}
|
||||||
|
|
||||||
|
return render(request, self.template_name, context)
|
||||||
|
|
||||||
|
|
||||||
|
def post(self, request):
|
||||||
|
|
||||||
|
cores = request.POST.get('cpu')
|
||||||
|
memory = request.POST.get('ram')
|
||||||
|
storage = request.POST.get('storage')
|
||||||
|
price = request.POST.get('total')
|
||||||
|
|
||||||
|
template_id = int(request.POST.get('config'))
|
||||||
|
|
||||||
|
manager = OpenNebulaManager()
|
||||||
|
template = manager.get_template(template_id)
|
||||||
|
|
||||||
|
request.session['template'] = VirtualMachineTemplateSerializer(template).data
|
||||||
|
|
||||||
|
if not request.user.is_authenticated():
|
||||||
|
request.session['next'] = reverse('hosting:payment')
|
||||||
|
|
||||||
|
request.session['specs'] = {
|
||||||
|
'cpu':cores,
|
||||||
|
'memory': memory,
|
||||||
|
'disk_size': storage,
|
||||||
|
'price': price,
|
||||||
|
}
|
||||||
|
|
||||||
|
return redirect(reverse('hosting:payment'))
|
||||||
|
|
||||||
class BetaAccessView(FormView):
|
class BetaAccessView(FormView):
|
||||||
template_name = "datacenterlight/beta_access.html"
|
template_name = "datacenterlight/beta_access.html"
|
||||||
|
|
Loading…
Reference in a new issue