Removed OpenNebula code from the IndexView and code reformatted

This commit is contained in:
M.Ravi 2017-07-26 20:39:51 +02:00
parent f3cfe19e68
commit 1f58da70d4

View file

@ -1,7 +1,7 @@
from django.views.generic import FormView, CreateView, TemplateView, DetailView
from django.http import HttpResponseRedirect
from .forms import BetaAccessForm
from .models import BetaAccess, BetaAccessVMType, BetaAccessVM
from .models import BetaAccess, BetaAccessVMType, BetaAccessVM, VMTemplate
from django.contrib import messages
from django.core.urlresolvers import reverse
from django.core.mail import EmailMessage
@ -199,19 +199,10 @@ class IndexView(CreateView):
for session_var in ['specs', 'user', 'billing_address_data']:
if session_var in request.session:
del request.session[session_var]
try:
manager = OpenNebulaManager()
templates = manager.get_templates()
vm_templates = VMTemplate.objects.all()
context = {
'templates': VirtualMachineTemplateSerializer(templates, many=True).data
}
except:
messages.error(request,
'We have a temporary problem to connect to our backend. \
Please try again in a few minutes'
)
context = {
'error': 'connection'
'templates': vm_templates
}
return render(request, self.template_name, context)